Flow logic
Branch with IF, Switch and Filter
Send items down different paths based on conditions.
IF
IF sends each item to the true or false output depending on conditions. Add one or more conditions and choose whether all or any must hold.
Each condition compares a value (usually an expression such as {{ $json.amount }}) with an operator for its type: text (is equal to, contains, starts with, ends with, matches regex…), number (greater than, less than…), boolean (is true, is false) or existence (exists, is empty).
Switch
Switch routes items to several outputs:
- Rules: one output per rule; an item goes to the first matching rule (or to all matching rules if you turn that on), and you can add a fallback output for items that match none.
- Expression: an expression returns the output number, for example
{{ $json.priority === "high" ? 0 : 1 }}.
Filter
Filter keeps only the items that match and drops the rest. Use it when you don't need a second branch.
Tips
- An empty branch is fine: the nodes after it simply don't run.
- After branching,
{{ $("Earlier node").json }}still finds the right item for each branch. See Expressions. - To bring branches back together, use Merge.