Switch


Example configuration for a switch. Here, a selection field is checked against several possible values and different actions are executed in each case. If none of the configured values is selected, the actions are executed on the far left in the fallback branch.

Since version 7.1.0+  available.

With the control of the type switch, the processing flow can be influenced depending on form values and other values by using placeholders. These elements allow the workflow to be split into several paths depending on a configured value corresponding to certain compare values.

The switch and the condition are very similar. Both can be used to split the workflow. The condition is useful if the comparable values match in different constellations. The switch increases the readability of the workflow if a certain value is to be compared against many possibilities and different actions will be executed. The exact order of execution is described in more detail below.

For example, the case difference can be used to check the value of a selection field selActivity and react differently to the cases of sports, reading, etc.

Configuration

Clicking on the box with the small question mark opens the configuration for the value to check. The value that should be checked against the different cases is entered here.

Clicking on the box of one of the configured cases opens the configuration for the comparing value. Here the value is entered to which the test value of the switch is compared. Furthermore, the type and value in which the two values are compared is selected. For advanced applications, several test values can be configured.

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.

Further cases are added by clicking on the plus symbol  ( ), 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.

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.