Switchcase - ObjectVision/GeoDMS GitHub Wiki
Logical functions switchcase
- switch(case1(condition, value),..,casen(condition, value), othervalue)
Switch case results in different values depending on conditions, specified as different cases. Each case is specified with the syntax: case(condition, value). Cases are separated by commas.
The last specified value (without condition) must be configured for the values that do not meet any condition (case other).
The switch case function is comparable to the select case function in Visual Basic.
Use the iif function if only one case (and the case other) is needed.
- condition data item with bool value type
- value subexpressions
- The domain unit of the conditions, values and the resulting data item must match or be void (literals or parameters can be combined with data items of any domain).
- The values unit of the values and the resulting data item must match.
attribute<string> switchA (ADomain) :=
switch(
case(Source/floatA < Source/floatB, 'A < B')
, case(Source/floatA > Source/floatB, 'A > B')
, case(Source/floatA == Source/floatB, 'A = B')
, 'Missing'
);
A(float32) | B(float32) | switchA |
---|---|---|
0 | 2 | 'A < B' |
1 | 2 | 'A < B' |
2 | 2 | 'A = B' |
3 | 2 | 'A > B' |
null | 2 | 'Missing' |
ADomain, nr of rows = 5
- iif ( ? : )