4.3 CASE
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
- Example 1
-
The following returns "A car" if
PRODUCT_CODE
is"CAR
" and "A truck" ifPRODUCT_CODE
is"TRUCK
". In this case, ifPRODUCT_CODE
fits neither of the first two cases, aFIELD_MISSING
indication is returned.@CASE (PRODUCT_CODE, "CAR", "A car", "TRUCK", "A truck")
- Example 2
-
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")