You are here: Commands > Let

Let

You can use the Let command to store a value as a variable. Although similar to the Assign command, Let allows multiple variable assignments on a single line rather than just one. Let does not support a condition

Let is typically used in a procedure in which you want to create or change the value of one or more variables on a single line.

Let can be used as a separate command or in a group. A Let command in a group performs the variable assignment each time the command is encountered, if the test evaluates true for that record at least once per record.

For more information on assigning variables see Assign. For additional information see User-Created Variables.

Command Mode Syntax

LET variable-name1 = expression1 variable-name2 = expression2 ...

variable-name = expression is interpreted automatically as an assignment.
variable-name specifies the name of the variable to be created. All field naming conventions apply. See Naming Fields for more details.
expression specifies the value to be assigned to the variable. All Analyzer expression conventions apply.

Examples

In the first example, the value of the product class for the current record is assigned to a user created variable named MPRODCLS by entering the command:

LET MPRODCLS = PRODCLS

Because MPRODCLS is a variable, its value will not change unless explicitly changed by another Let or Assign command.

In the next example, the variables MPRODCLS and SAMPLE_QTY will be assigned values at the same time:

LET MPRODCLS = PRODCLS SAMPLE_QTY = 1