Allows the user to select a value depending on a series of independent tests. There is no practical limit to the number of conditions. If the number of cases is large, it is beneficial to list the most frequently encountered conditions first.
Syntax
@EVAL (condition1, result1 [, condition2, result2] [, ...] [, default_result])
Examples
In the following example, if AMOUNT
is greater than 10000, "high amount
" is returned. If AMOUNT
is greater than 5000
(and less than or equal to 10000
), "somewhat high
" is returned (unless the prior condition was satisfied). If neither condition is satisfied, a COLUMN_MISSING
indicator is returned because a default result is not specified.
AMOUNT_DESC = @EVAL (AMOUNT > 10000, "high amount", AMOUNT > 5000, "somewhat high")
The following is a modification of the preceding example. It returns the same results, except that a default value is specified, and a result of "lower
" is returned if AMOUNT
is less than or equal to 5000
.
@EVAL (AMOUNT > 10000, "high amount", AMOUNT > 5000, "somewhat high", "lower")