CASE
Syntax
CASE(<default value>; <any>; <case 1>; <return value 1>; <case 2>; <return value 2>; ...)
or
CASE(<default value>; <boolean condition 1>; <return value 1>; <boolean condition 2>; <return value 2>; ...)
Description
Exchanges values for others based on either specific cases or boolean conditions. Each case is evaluated in order. If none of the specified cases apply, the function returns the default value. Parameters must appear in pairs. The return and default values must be of the same type.
Default values cannot be NULL.
Examples
CASE(0;#Column1;"org";1;"gov";2;"com";3;"mil";null)
Column1 | CASE returns |
---|---|
org | 1 |
gov | 2 |
mil | NULL |
biz | 0 |
com | 3 |
net | 0 |
CASE("10 or under";GE(#Column1;11);"Over 10")
Column1 | CASE returns |
---|---|
2 | 10 or under |
4 | 10 or under |
6 | 10 or under |
8 | 10 or under |
10 | 10 or under |
12 | Over 10 |
14 | Over 10 |
16 | Over 10 |
18 | Over 10 |
20 | Over 10 |