Switch ('Selector_Expression',

'Case_1_Expression','Value_1_Expression',

'Case_2_Expression','Value_2_Expression',

'Case_n_Expression','Value_n_Expression',

'Default_Value_Expr')

Arguments

'Selector_Expression'

Expression that is checked for different conditions

'Case_n_Expression'

Expression that is compared with 'Selector_Expression'

'Value_n_Expression'

Result if 'Select_Expression' and 'Case_n_Expression' match

'Default_Value_Expr'

Result if none of the 'Case_n_Expressions' match with 'Selector_Expression'

Description

These instructions compare an incoming 'Selector_Expression' with any number of 'Case_n_Expressions' resembling the SQL statement CASE. At least 3 arguments are needed. With an even number of arguments, the last argument is automatically interpreted as 'Default_Value_Expr', which is used if none of the 'Case_n_Expressions' matches with the 'Selector_Expression'.

If 'Selector_Expression' and 'Case_n_Expression' match, the corresponding 'Value_n_Expression' is returned. If several 'Case_n_Expressions' match the input signal, the first is automatically selected.

The following signals are allowed as 'Selector_Expression':

  • a numeric constant

  • a text constant

  • an equidistant and not equidistant sampled signal

  • a text signal

In general, the types of comparison values must match, otherwise the corresponding case is not selected.