Switch
Available since version 7.1.0+ .
You can use a switch condition to check a value againdt multiple cases and split the workflow into multiple branches to run different action depending on that value. The switch checks a configured value against all cases, and when a case matches, it executes the actions of that case.
The switch and the condition are very similar. Both can be used to split the workflow. The condition is useful if you only have a single yes/no condition. When you need to compare a value against multiple cases, use the switch to make the workflow configuration look nicer and easier to understand at first glance.
For example, the switch can be used to check the value of a select field selActivity and react differently depending on whether sports, reading, etc. was selected.
Configuration
A click on the box with the small question mark opens the configuration for the value to be checked. Here will be the value for checking entered to which the switch is to be applied, i.e. the field that is to be checked against the different cases.
), existing cases are deleted by clicking on the trash symbol ( ). Clicking on one of the boxes of the individual cases opens the configuration for that case. The value to compare against is entered here. Furthermore it is selected how the test value is compared against the test value. By default, equality is checked, but other comparisons such as greater than equal or unequal are also possible. Furthermore it is possible to change the order of the individual cases via drag & drop.
Further cases are added by clicking on the plus symbol (If required, the test value can also be compared against several test values (multiple condition). The configuration here is analogous to the condition, see the help page for the condition for more information.
For each of the individual cases, workflow actions can then be added, which are to be executed in this case. Finally, there is the fallback branch on the far left. Here you can add the actions that are to be executed if none of the cases match.
Execution
Sometimes it is necessary to know exactly what happens during case differentiation. In practical terms, the switch is executed out as follows:
- Compare the test value with the corresponding values of the individual cases. This results in a list of all matching cases.
- If the list of matching cases is not empty
- Go through the individual cases from left to right (as configured in the workflow) and execute the actions configured in the corresponding case.
- If an action ends in an unhandled error, the remaining cases are no longer executed and the error is passed upwards.
- If the list of matching cases is empty:
- Perform the actions of the fallback branch.
This means that if several cases match at the same time, then all cases are executed. Namely in order from left to right as configured in the workflow.