
The optional assign command is used to give a value to a temporary or global variable. (You must define a variable before you can assign it a value.) A variable is used to store a value, such as a text string or a calculated result, that can change during the processing of a procedure. By specifying the variable's name, the stored value can be used like any other value in a script.
The status of a variable can be global (denoted by the keyword global) or temporary (denoted by the keyword temp). A temporary variable maintains it's value only during the current procedure. A global variable can pass its value from one procedure to another. To pass a value from one procedure to another, the global variable must be defined identically in each procedure.
Syntax
assign global|temp VARIABLE NAME := ASSIGNED VALUE .
The assign command is followed by:
The name of the variable (without quotation marks).
The assignment operator.
A period.
define temp "DISCOUNT" Number .
for RESERVATIONS with TOTAL DUE > 2000 ;
assign temp DISCOUNT := RESERVATIONS
TOTAL DUE := TOTAL DUE - temp DISCOUNT .
This script tells DataEase: (1) Create (define) a temporary variable called DISCOUNT to store a number while processing the current script, (2) find all the RESERVATIONS records that have a value greater than 2000 in the TOTAL DUE field, (3) give (assign) the DISCOUNT variable a number value determined by multiplying the TOTAL DUE on each reservation by 15%, and (4) modify these RESERVATIONS records by subtracting the value of the DISCOUNT variable from the value in the TOTAL DUE field.