Allows the user to select a value depending on a series of value tests. There is no practical limit to the number of cases; however, for numerous cases, it is beneficial to list the most frequently encountered conditions first.
Syntax
@CASE (value, test_value1, test_result1 [, test_value2, test_result2] [, ...] [, default_result])
Examples
The following returns "A car" if PRODUCT_CODE
is "CAR
" and "A truck" if PRODUCT_CODE
is "TRUCK
". In this case, if PRODUCT_CODE
fits neither of the first two cases, a FIELD_MISSING
indication is returned.
@CASE (PRODUCT_CODE, "CAR", "A car", "TRUCK", "A truck")
In this modified case, assuming PRODUCT_CODE
is neither "CAR
" nor "TRUCK
", "A vehicle
" is returned.
@CASE (PRODUCT_CODE, "CAR", "A car", "TRUCK", "A truck", "A vehicle")