The CHOICE and IF-THEN-ELSE value expressions return a value based on the evaluation of one or more Boolean expressions. These value expressions are useful when you need to assign values that depend on certain conditions. They can be used in any statement that accepts value expressions, as well as in COMPUTED BY clauses for variables or field definitions.
1 – CHOICE Value Expression
Returns one of a series of values depending on the evaluation of a series of conditional (Boolean) expressions. Format CHOICE [OF] boolean-expression-1 [THEN] value-1 [boolean-expression-2 [THEN] value-2] . . . . . . . . . ELSE value-n END_CHOICE
1.1 – Arguments
CHOICE Marks the beginning of a CHOICE value expression. OF Is an optional word used to clarify syntax. boolean-expression Is a Boolean expression. THEN Is an optional language element you can use to clarify syntax. value Is the value returned by DEC DATATRIEVE if the corresponding Boolean expression evaluates to true. ELSE value-n Is the value returned by DEC DATATRIEVE if all the Boolean expressions evaluate to false.
2 – IF THEN ELSE Value Expression
Returns one of two values depending on the evaluation of a conditional (Boolean) expression. Format IF boolean-expression [THEN] value-1 ELSE value-2
2.1 – Arguments
boolean-expression Is a Boolean expression. THEN Is an optional language element you can use to clarify syntax. value-1 Is the value returned by DEC DATATRIEVE if the Boolean expression evaluates to true. ELSE value-2 Is the value returned by DEC DATATRIEVE if the Boolean expression evaluates to false.