Skip to content

Switch

Switch splits your data between several paths. It looks at the value of a field in each record, compares it with the conditions you define (the cases) and sends the record through the output of the case it matches. It is the way to say “if the status is paid, do this; if it is pending, do that”.

When to use it

  • Send each order to a different process depending on its status: paid, pending or cancelled.
  • Route customer queries to the right team based on their category.
  • Separate records that have a piece of information, such as an email, from those that don’t.
  • Follow one path or another based on a yes or no answer.

Configuration

FieldWhat it does
Data InputThe records you want to split. Accepts one or more.
Switch Key (required)The field whose value is evaluated, for example status. For a field inside another one, separate them with a dot: customer.country.
Number of Cases (required)How many cases you want to define, from 1 to 30. Default: 1. Each case has its own output.

Cases

For each case a group Case 1, Case 2, etc. appears, with these fields:

FieldWhat it does
Operator (required)How the field value is compared. Default: equals. See the operators table.
ValueThe value to compare with. It does not appear for operators that don’t need it.
OperatorMatches when the field value…
equals / not equalsis equal / different to the given value.
contains / not containscontains / does not contain the given value.
starts with / ends withstarts / ends with the given value.
is empty / is not emptyis empty / has content.
exists / not existsexists and has data / does not exist or has no data.
boolean validatorrepresents a “yes”: true, yes, y, 1 or on.

Comparisons are case-sensitive.

Routing options (advanced)

FieldWhat it does
First Match OnlyIf a record matches several cases, it only leaves through the first one. Off by default: the record leaves through every case it matches.
Enable Default OutputAdds a Default output that receives the records that match no case. Off by default.

Output

  • Case 1, Case 2…: one output per case, with the records that match it. If no record matches a case, that output stops and the components connected to it do not run.
  • Default: only if you turn on Enable Default Output. Receives the records that matched no case.

With Batch Mode on, each output lets through only the records that match its case.

Example

Your store receives orders with a status field. You set Switch Key to status and Number of Cases to 2. In Case 1 you choose equals and paid, and connect its output to the component that prepares the shipment. In Case 2 you choose equals and pending, and connect its output to a payment reminder email. You turn on Enable Default Output to alert the team about any order with a different status.

Good practices

  • Turn on Enable Default Output so you don’t lose records that fit no case.
  • If a value may arrive with different capitalization, normalize it first with Text Formatter.