Select Page
< All Topics
Print

Switch Node

The Switch node is the place when you define much of your flow logic.  You create cases that define the logic and the output for a given scenario.  Comparators are the building blocks of the logic within switches, such as =, !=, >, <, etc. To select different comparators, click the dropdown next to the case number. Options include equals, does not equal, contains, does not contain, less than, less than or equal to, greater than or equal to, greater than, is null or undefined, and is not null or undefined.

The Switch node can only process data from one field of input in each switch. To combine logic for multiple fields of input, combine multiple switches. Check out the figure below:

In this switch, we have three possible cases for the I-1: nozzle25 field.  For each case, we’re testing if I-1: nozzle25 equals either 1) Damaged – Right, 2) Damaged – Left, or 3) Damaged – Both.  And if it does equal one of those three, we update the downstream fields with the values defined. If you think of an if/else if statement, we have created an if statement with case 1 and else if statements with cases 2 and 3.

The optional Default case handles any scenario where one of the three cases is not true. The default case in this example would represent another else if statement. If the switch only had one case and the default, it would represent an if/else statement stating if case 1 = abc, the default = everything else.

Important! It’s important to note that you should set up your switch cases so that there can be only one possible case selected. Otherwise, the first true case only will process, and you may miss some data you intended to process because the data will process through the cases in order of sequence. If data matches the logic for case 1, it will not go through case 2, etc.

How to set up an “if 1 or 2”

Starting with the same example in Figure 38, In this switch, we have three possible cases for the I-1: nozzle25 field.  For each case, we’re testing if I-1: nozzle25 equals either 1) Damaged – Right, 2) Damaged – Left, or 3) Damaged – Both.  To set up logic that follows “if 1 or 2”, we could take cases number one and two and connect those to the next node in the workflow. This would process data through the next node that either equals case 1 OR case 2 in the switch. You could follow this logic for as many cases as need, i.e. if 1 or 2 or 3 or 4.

How to set up an “if 1 and if 2”

To set up a case where a value matches the statement “if 1 and 2”, the use of more than one switch is required. To build on the previous example using “if 1 or 2” logic, if we need to test that I-1: nozzle25 equals 1) Damaged – Right AND I-1: bonnetbolts equals 1) Damaged, we will need to create a second switch with the logic I-1: bonnetbolts equals 1) Damaged. You can also add any other value for bonnetbolts that should be processed. To set the logic to “if 1 and 2”, you would connect case 1 on the first switch to the second switch, then connect case 1 on the second switch to the next node in the workflow.

Table of Contents