Switch#
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.
Inputs#
| Name | Data Type | Description |
|---|---|---|
| value (can be changed) | <custom> | Type of value to compare against each of the possible outputs |
| Activate | any | Required. Triggers the comparison. The task only evaluates the configured outputs when Activate fires. |
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 | LongDecimalDateTimeBooleanStringInteger | Type of data expected to receive from the input |
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 | LongDecimalDateTimeBooleanStringInteger | Type of data expected output if the Equals To value matches the input | |
| Collection Type | NoneArrayMap | 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.
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 | LongDecimalDateTimeBooleanStringInteger | Type of data that will output if none of the other outputs match the input value | |
| Collection Type | NoneArrayMap | None | Type of data to output (not yet used) |
| Value | any | Exact value to output |
Behavior#
When Activate fires, the task takes the current value (from the value input if it was received, otherwise from the activation value itself) and tests each configured output for a match. If a match is found, the configured value and type is emitted and no other output is tested.
If all outputs are tested and no match is found and a default output value is defined, the default output emits its Value as stored, without converting it to its Type. If no default output is defined, nothing is emitted.
Note
The Activate input must always be linked. Emitting only a value does not trigger the comparison. Wire Activate to the signal that should drive the switch evaluation.
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.
The task converts the value and each Equals To to the input Type before comparing them. A DateTime value is compared as text, so two spellings of the same instant do not match.
When the workflow stops, a task without a default output fails, and the error goes to Error, or to the Unhandled Error task when Error is not linked.



