Switch
Routes data to different branches based on conditions. Each item flowing through the Switch node is evaluated against your rules and sent to the first matching output, or to the fallback output if no rule matches.
Configuration
Routing Rules
You can define up to 10 routing rules. Each rule creates a separate output handle (labeled case-1, case-2, etc.) and contains a condition group with one or more conditions joined by AND/OR logic.
Each condition within a rule has three parts:
| Part | Description |
|---|---|
| Input | A field path to evaluate, e.g., data.status or data.user.role |
| Operation | The comparison to perform (see table below) |
| Value | The value to compare against (not required for all operations) |
Available Operations
| Operation | Description | Requires Value |
|---|---|---|
equals | Exact string match | Yes |
not_equals | Does not match | Yes |
greater_than | Numeric greater than | Yes |
less_than | Numeric less than | Yes |
greater_than_or_equals | Numeric greater than or equal | Yes |
less_than_or_equals | Numeric less than or equal | Yes |
contains | Input contains the value as a substring | Yes |
not_contains | Input does not contain the value | Yes |
starts_with | Input starts with the value | Yes |
ends_with | Input ends with the value | Yes |
in | Input matches one of the comma-separated values | Yes |
not_in | Input does not match any of the comma-separated values | Yes |
matches_regex | Input matches a regular expression | Yes |
is_empty | Input is an empty string | No |
is_not_empty | Input is not empty | No |
is_true | Input is true or 1 | No |
is_false | Input is false or 0 | No |
is_type | Checks the data type of the input | Yes |
Condition Logic
Within each rule, you can combine multiple conditions using:
- AND -- All conditions must be true for the rule to match
- OR -- At least one condition must be true for the rule to match
Output
The Switch node creates one output handle per rule, plus a fallback handle:
- case-1, case-2, ... case-N -- Items that match the corresponding rule
- fallback -- Items that do not match any rule
Each item is sent to the first matching rule only. If an item matches both rule 1 and rule 3, it goes to case-1.
TIP
Order your rules from most specific to least specific, since items are routed to the first match.
INFO
Items that arrive when no rules are configured will all be routed to the fallback output.