Control Flow

If / Else and Switch Nodes Reference

Technical reference for `ifElse` and `switch`, including condition operators, branch handle behavior, and routing rules.

Updated 2 min read

Overview

ifElse and switch are branch routers:

  • ifElse splits a collection into true and false branches.
  • switch evaluates ordered cases and activates the first matching case handle, or default.

Configuration / Settings

NodeSettingDetails
ifElsevariable, operator, valueSupports file-specific checks such as fileSize and fileName, plus nested object paths like customer.total.
switchvariable, caseCount, cases[].conditions[], logicOperatorCases support AND/OR compound logic and operators such as equals, greater-than, contains, regex, empty, and not-empty.

Inputs Expected

  • ifElse accepts single items or arrays. Arrays are evaluated item by item.
  • switch evaluates a single resolved variable string and routes the original input forward on one handle.

Variables Exported / Outputs

NodeOutput shapeBranch behavior
ifElseoriginal input arrayBranch-specific arrays are sent through the true and false handles via metadata.
switchoriginal inputThe executor records matchedCase metadata and activates one handle only.

Important implementation detail:

  • Branch-routing data such as selectedHandles and handleOutputs lives in executor metadata and is consumed by the engine, not by {{node_id.field}} expressions.

Common Use Cases

  • Route PDFs larger than a threshold to compression while small files skip it.
  • Send different document types to different conversion branches.
  • Split rows by status or approval result before emailing or archiving.

Edge Cases

  • ifElse returns both handles when there is no data, but with empty arrays.
  • switch stops on the first matching case, so case order matters.
  • Regex operators fail closed if the pattern is invalid.