Aller au contenu
Agentic Workflowdocs
v0.8.2Installer gratuitement

nœuds / builtin / flow

Switch

Route items to any number of named branches, with a fallback for the rest

Flux ExtensionApplication web

Ce contenu n’est pas encore disponible dans votre langue.

Send each item down one of several named branches, with a fallback branch for the rest.

workflow · classify-and-route.awf 8 étapes

Classify and Route : un workflow de 8 étapes, qui commence par Run now et se termine par Other branch, avec 1 point de ramification.

Ouvrir dans AWFlow

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 200 matches a branch named 200.

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.

  • 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.

RéglageTypeCe que cela fait
Mode ChoiceDecide the branch by conditions, or by matching a value to a name. Options: Rules, Expression. Par défaut : Rules
Rules List of entriesOne per branch, tried from top to bottom.
Rules (each entry) › Output Name (obligatoire)TextName of the branch items matching this rule are sent to.
Rules (each entry) › Conditions ConditionsWhen these hold, the item takes this branch.
Value To Match ValueCompared against each output name, in Expression mode.
On Multiple Matches ChoiceWhether an item takes only the first matching branch, or every one. Options: First match only, Every match. Par défaut : First match only
Add A Fallback Branch ToggleSend items matching no rule to an output of their own. Par défaut : On
Fallback Name TextName of the branch for items matching no rule. Par défaut : 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 as Urgent (2).
  • 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.

None. This node needs no connection and has no slots for other nodes.

Handle support tickets by status:

  1. Http Request gets https://api.example.com/tickets, which returns a list of tickets.
  2. Split Out with Field To Split Out data and Output field name ticket makes one item per ticket.
  3. Switch with Mode Expression, Value To Match {{ $input.ticket.status }}, and two rules named urgent and open. Keep the fallback named Anything else.
  4. 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.
  • “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.
  • 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.
Modifier cette page

Dernière mise à jour :

Was this page useful?
Demander à Aria à propos de Switch