logo-header

 
 

syntax

  • switch(case1(condition, value),..,casen(condition,value),othervalue)

definition

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 seperated by commas.

The last specified value (without condition) must be configured for the values that do not meet any condition (case other). 

description

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.

applies to

Conditions with bool value type

Subexpressions value

conditions

1. The domain 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).
2. The values unit of the values and the resulting data item must match.

since version

5.15

example

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

see also


OBJECT VISION BV
Vrije Universiteit
De Boelelaan 1085
1081 HV Amsterdam
The Netherlands

tel: +31 (0)20 598 9083
fax:+31 (0)20 598 9904