nodes / builtin / flow
Route by value
Route items to any number of named branches, with a fallback for the rest
Formerly Switch. The step was renamed in AWFlow 0.9; searching for the old name still finds it.
Send each item down one of several named branches, with a fallback branch for the rest.
Try it
Section titled “Try it”Classify and Route: a workflow with 8 steps, starting with Run now and ending with Other branch, with 1 branching point.
- Other branch(Display Markdown — open its doc page) if otherwise
What it does
Section titled “What it does”Switch has one output per rule you add, named after the rule, plus a fallback output for items that match no rule. If gives you two branches; Switch gives you as many as you need, without nesting IF nodes.
There are two ways to pick the branch, set with Mode:
- Rules: each rule has its own Conditions, built like the ones in IF. Rules are tried from top to bottom, and by default the first one that matches wins, so put narrow rules above broad ones. A rule with no conditions never matches.
- Expression: one value, Value To Match, is compared with each rule’s Output Name. The item goes to the branch whose name is exactly that value. The comparison is done as text, so the number
200matches a branch named200.
Items that match nothing go to the fallback branch (Anything else by default). Turn off Add A Fallback Branch and they are dropped instead. Set On Multiple Matches to Every match to send an item to every branch it matches.
Conditions in AWFlow 0.9
Section titled “Conditions in AWFlow 0.9”New Route by value steps (version 2) build conditions as cards, one rule per card:
- Match all or Match any applies to a whole group of rules, and Add group nests a group inside another, so “A and (B or C)” is easy to read. AND / OR between cards is shown for you.
- Operators have plain names, grouped by type: is equal to, contains, matches pattern (advanced), length is… and so on. Lists and objects are compared by their content.
- Options › Type check: Loose converts values when it can (with a warning), Strict fails the step and names the rule and the item when a value has the wrong type. Ignore case compares texts without caring about capitals (an Aa ignored chip shows it).
- An empty date or number never counts as a date or as 0: the rule is false and the run log says why. An invalid pattern or date fails with “Condition N: …”.
Steps saved before 0.9 keep their rows, read top to bottom with each row’s own AND/OR. Update in the step’s header converts them to groups with exactly the same meaning. XOR means “exactly one of the two” (it used to behave like OR); it is only offered on rows that already use it.
When to use it
Section titled “When to use it”- Route items to Billing, Bug or Other depending on words in their title (Rules mode).
- Split a list by a status or category field whose values are the branch names (Expression mode).
- Handle three or more cases where you would otherwise chain IF nodes.
For two branches, If is simpler. To drop non-matching items, use Filter.
Inputs and settings
Section titled “Inputs and settings”| Setting | Type | What it does |
|---|---|---|
| Mode | Choice | Decide the branch by conditions, or by matching a value to a name. Options: Rules, Expression. Default: Rules |
| Rules | List of entries | One per branch, tried from top to bottom. |
| Rules (each entry) › Output Name (required) | Text | Name of the branch items matching this rule are sent to. |
| Rules (each entry) › Conditions | Conditions | When these hold, the item takes this branch. |
| Value To Match | Value | Compared against each output name, in Expression mode. |
| On Multiple Matches | Choice | Whether an item takes only the first matching branch, or every one. Options: First match only, Every match. Default: First match only |
| Add A Fallback Branch | Toggle | Send items matching no rule to an output of their own. Default: On |
| Fallback Name | Text | Name of the branch for items matching no rule. Default: Anything else |
- In Expression mode, rules only need an Output Name; their conditions are ignored. Set Value To Match to the field to compare, for example
{{ $input.status }}, and name the rules after the possible values (open,closed). Matching is case-sensitive. - A rule left without a name is called
Rule 1,Rule 2, and so on. Two rules with the same name get a suffix, such asUrgent (2).
Outputs
Section titled “Outputs”-
Anything else
More ports appear as you add them in the settings (one per rule).
Items leave unchanged through the branch they took. Connections are tied to the branch name: reordering rules keeps every connection in place, but renaming a rule removes the connection that left it, and the canvas tells you so.
Dependencies and credentials
Section titled “Dependencies and credentials”None. This node needs no connection and has no slots for other nodes.
Example workflow
Section titled “Example workflow”Handle support tickets by status:
- Http Request gets
https://api.example.com/tickets, which returns a list of tickets. - Split Out with Field To Split Out
dataand Output field nameticketmakes one item per ticket. - Switch with Mode Expression, Value To Match
{{ $input.ticket.status }}, and two rules namedurgentandopen. Keep the fallback namedAnything else. - From urgent: Slack posts
{{ $input.ticket.title }}to your support channel. From open: Todoist creates a task. Leave Anything else unconnected to ignore the rest.
Common issues
Section titled “Common issues”- “Switch needs at least one rule. Add one, and name the branch it routes to.” Add a rule under Rules.
- “No source node is connected to this node.” Connect a node to the Switch input.
- Everything goes to the fallback. In Rules mode, a rule without conditions never matches, so check each rule has its conditions. In Expression mode, the value must equal an Output Name exactly, including capital letters and spaces.
- A connection disappeared after editing a rule. You renamed the rule, which disconnects its branch. Reconnect it from the new name.
- An item went down only one branch although it matched two. On Multiple Matches is First match only. Switch it to Every match.
Related nodes
Section titled “Related nodes”- If: two branches, true or false.
- Filter: keep only matching items.
- Funnel: bring the branches back together afterwards.
- Text Classifier: let an AI model pick the category first.