Skip to content

Switch#

Screenshot showing a switch control with input options.

The switch task works as the switch statement in most programming languages. There is an input value, one or more possibilities and optionally, a default (if no possibility is a match). The switch task allows you to also define what value and type will be emitted if a match is found. The output types can be different.

Screenshot showing a switch with 2% label.

Inputs#

Name Data Type Description
value (can be changed) <custom> Type of value to compare against each of the possible outputs

Outputs#

Name Data Type Description
<custom list> <custom> Value and type to emit if a match is found
default (can be changed) <custom> Value and type to emit if none of the outputs listed in the <custom list> matches with the input value

Settings#

On the General Tab, you have the usual settings, and the Input section with the following settings:

Name Data Type Default Description
Friendly Name string "Value" Name that will identify the input value
Type Long
Decimal
DateTime
Boolean
String
Integer
Type of data expected to receive from the input

Screenshot showing a settings page with examples of different data types.

On the Outputs tab, each item that belongs to the custom list has the following settings:

Name Data Type Default Description
Name String Name that will identify the input value
Equals To any Value to try to match with the input value
Type Long
Decimal
DateTime
Boolean
String
Integer
Type of data expected output if the Equals To value matches the input
Collection Type None
Array
Map
None Collection Type of data to output (not yet used)
Value any Exact value to output if a match is found

Note

The value emitted by each output may be of a different type.

Screenshot showing a settings page with options for collection type, including "None", "Array", and "Map".

And finally, the Default Output tab, you can optionally add a final output that will be used if none of the previous ones match the input.

Name Data Type Default Description
Name String Name that will identify the output value
Type Long
Decimal
DateTime
Boolean
String
Integer
Type of data that will output if none of the other outputs match the input value
Collection Type None
Array
Map
None Type of data to output (not yet used)
Value any Exact value to output

Screenshot showing a settings page with options for collection type and data output.

Behavior#

Every time there is an input value (even if it didn't change since the last value), each output is tested to check if it matches with the input value. If a match is found, then the configured value and type is emitted and no other output value is tested.

If all outputs are tested and no match is found and if there is a default output value defined, then it is emitted according to the type. If no default output is defined then nothing will be emitted.

Remarks#

This task checks for exact compare. It is not possible to compare a similarity or a range. For that kind of comparisons, use the Expression Evaluator task instead.

When the first match is found, no other possible outputs will be tested.