Switch
When an If/Else node isn't enough, the Switch node comes to the rescue. It evaluates a single expression against multiple possible cases and routes the execution precisely down the matching path. It significantly cleans up your Canvas by replacing deep nests of conditional logic.
What can you do with Switch?
Multi-Branch Operations
Create robust 3, 5, or even 10 different output execution branches based on a single condition (e.g., routing based on "Order Status = Pending / Paid / Failed / Refunded").
Fallback Default Path
Includes a built-in unhandled default fallback route, ensuring your mission-critical workflow never hangs indefinitely if unexpected or corrupted data arrives.
Visual Organization
Keeps complex logic routing matrices perfectly organized visually via independent output connection points, drastically reducing canvas spaghetti.
Detailed Usage & Configuration
The Switch node elegantly solves the "nested If/Else" problem. Instead of chaining six If/Else nodes together to handle six different possible invoice statuses, the Switch node routes execution natively through custom conditional outputs.
1. Rule Evaluation
Set a primary variable to test against (e.g. {{ $json.status }}). You then add explicit Routing Rules.
If Rule 0 (status == 'failed') matches, execution flows linearly out of port 0. If Rule 1 (status == 'paid') matches, it flows out of port 1.
2. The Default Fallback
Every Switch node features a critical "Fallback" output port. If the incoming item fails to strictly match any of your explicitly defined rules, it defaults to this port instead of terminating the execution entirely. Always map the fallback port to a logging or alerting module to aggressively catch unexpected data states.
