Switch
Give the workflow multiple options to continue on.

Operations
The Switch node offers two modes: Rules and Expression.
Rules
Use comparison operators to define routing rules for each output. The following parameters are available:
- Data Type: The type of input data. Supported types include Boolean, Date & Time, Number, and String.
- Value 1: The input value to be compared. This can be a fixed value or an expression.
For example, to use the
id
field from the previous node’s JSON output, use the expression{{ $json.id }}
. - Fallback Output Name or ID: The output index to route to if no conditions are met.
- Routing Rules: Define as many rules as needed. Each rule compares Value 1 against Value 2 using a chosen operator. If the condition is met, the workflow is routed to the specified output index. If more than one rule condition is met, the workflow execute all of the matching nodes. Each rule includes:
- Operation: The comparison to perform (defaults to Equal if left blank).
- Value 2: The value to compare against Value 1.
- Regex (for String type only): A regular expression to match Value 1.
- Output Key: The index of the output to route to if the condition is true.
The available operators vary depending on the data type:
Number Type Operators
- Smaller:
true
if Value 1 is less than Value 2. - Smaller or Equal:
true
if Value 1 is less than or equal to Value 2. - Equal:
true
if Value 1 equals Value 2. - Not Equal:
true
if Value 1 differs from Value 2. - Larger:
true
if Value 1 is greater than Value 2. - Larger or Equal:
true
if Value 1 is greater than or equal to Value 2.
Boolean Type Operators
- Equal:
true
if Value 1 equals Value 2. - Not Equal:
true
if Value 1 differs from Value 2.
Date & Time Type Operators
- Occurred After:
true
if Value 1 is after Value 2. - Occurred Before:
true
if Value 1 is before Value 2.
String Type Operators
- Contains:
true
if Value 2 is a substring of Value 1. - Not Contains:
true
if Value 2 is not a substring of Value 1. - Ends With:
true
if Value 1 ends with Value 2. - Not Ends With:
true
if Value 1 does not end with Value 2. - Equal:
true
if Value 1 equals Value 2. - Not Equal:
true
if Value 1 differs from Value 2. - Regex Match:
true
if Value 1 matches the regex pattern. - Regex Not Match:
true
if Value 1 does not match the regex pattern. - Starts With:
true
if Value 1 starts with Value 2. - Not Starts With:
true
if Value 1 does not start with Value 2.
Expression
In Expression mode, you define the output index using a custom expression. This mode has two parameters:
- Output: A fixed number or an expression that evaluates to the desired output index. Using an expression is recommended.
- Outputs Amount: The total number of output branches available in the node.