Skip to content

Switch ​

The Switch node performs multi-way branching by grouping rows based on a field's value. Each unique value becomes a separate output branch.

Configuration ​

PropertyTypeDefaultDescription
fieldstring--Required. The field name to switch on (e.g., status, type, category).

Input ​

Accepts an array of rows. Each row must contain the specified field.

Output ​

Returns an associative array where each key is a unique field value and the value is an array of matching rows:

json
{
  "active": [
    { "id": 1, "name": "Item A", "status": "active" },
    { "id": 3, "name": "Item C", "status": "active" }
  ],
  "pending": [
    { "id": 2, "name": "Item B", "status": "pending" }
  ],
  "_default": [
    { "id": 4, "name": "Item D", "status": null }
  ],
  "_branching": true
}

Rows where the field is null or empty are grouped under the _default key.

How It Works ​

  1. The node iterates over all input rows.
  2. For each row, it reads the value of the configured field.
  3. Rows are grouped into buckets by their field value.
  4. The result is an associative array with the _branching: true marker.

Example Use Cases ​

Route by order status ​

field: "status"

Input rows are split into groups like pending, processing, shipped, delivered. Each group can be routed to different downstream processing.

Category-based layout ​

field: "type"

Different item types (article, video, gallery) get different display templates.

Priority-based processing ​

field: "priority"

Items are grouped by priority level (low, medium, high, critical) for different handling logic.

TIP

For simple two-way branching (true/false), use the If/Else node instead. Switch is better when you have 3 or more possible paths.