core.switch

Switch (core.switch)

Route each item across up to 8 named outputs — one output per rule, first match wins. Where IF answers yes/no, Switch fans items out by category: status = "paid" → one path, status = "overdue" → another, everything else → the fallback.

Parameters

ParameterTypeDefaultDescription
ruleslist of rules[]Each rule is a condition (data_type + left + operator + right, same system as IF/Filter) plus an output_name that labels its output handle. One output per rule, up to 8.
include_fallbackbooleanfalseAdds a trailing fallback output that collects items matching no rule. Off → unmatched items are dropped.

Behavior

rules   k equals "paid" → "paid" · k equals "overdue" → "chase"
input   {"k": "paid"}  {"k": "overdue"}  {"k": "draft"}
paid  → {"k": "paid"}
chase → {"k": "overdue"}
        {"k": "draft"} dropped (no fallback configured)

First match wins. Items are tested against rules top to bottom and take the first output whose condition holds — an item can never land on two outputs, even if a later rule also matches. Reorder rules to change precedence.

Conditions behave exactly like IF's — same operators per data type, same tolerant coercion, same "incomparable values are false, never a crash" rule. An item that fails a rule for shape reasons simply falls through to the next rule (and eventually to the fallback or the floor).

Items carry their binary attachments and a paired_item back to their source index, whichever output they take.

Quirks & tips

  • A blank rule matches everything. A freshly-added rule with no left/right filled in compares null to null — which is equal, so every item takes that output until you configure it. If all your items suddenly route to one branch, look for an unfinished rule.
  • The fallback consumes one of the 8 slots. With fallback on, 7 rules route; an 8th rule's items can only reach the fallback. The canvas labels the trailing handle fallback accordingly.
  • Unmatched items vanish silently without the fallback. If your counts don't add up, turn include_fallback on and see what's falling through.
  • A missing reference stops the node{{ $json.nope }} in a rule's left is an expression error, same contract as every node parameter.
  • Deleting or reordering a rule doesn't move its edges. Edges stay wired to branch indexes, so after removing rule 2 the edge that pointed at it now carries rule 3's traffic. Re-check connections after reshuffling rules.

Related

  • IF — two-way routing when the question is yes/no.
  • Filter — keep/drop without routing.
  • Merge — bring the branches back together downstream.