Skip to main content
The Switch (Router) component introduces conditional multi-branch routing into Quixa workflows. It inspects predecessor status codes, response payloads, or flow variables and dynamically directs execution down matching downstream paths.

1. Visual Multi-Case Builder

In the Switch Configuration Dialog, you can configure multiple discrete routing branches:
  • Branch Label: A human-readable identifier (e.g. Payment Approved, KYC Required, Declined).
  • Source Expression / Variable: The target variable to evaluate, such as:
    • {{PaymentStep.statusCode}}
    • {{PaymentStep.response.status}}
    • {{flowVars.retryCount}}
  • Comparison Operator:
    • Numeric & String Equality: ==, !=
    • Numeric Thresholds: >, <, >=, <=
    • String Matching: contains, not_contains, starts_with, ends_with
    • Nullability: is_empty, is_not_empty
  • Match Value: The expected constant or dynamic comparison value.
Switch can also operate in Expression Mode, evaluating raw JavaScript expressions (e.g. item.totalPrice > 500 && item.currency === 'USD').

2. Dynamic Handles & Color-Coded Badges

The Switch is drawn as a decision diamond, like the IF node. A short stem leaves its right corner to a port rail with one labelled output port per case, in case order; the optional DEFAULT port leaves the bottom corner, like FALSE on an IF:
  • case-0: Connected to the first matching branch.
  • case-1, case-2…: Subsequent condition branches.
  • default: An optional fallback port (bottom corner) triggered when no case matches.
The diamond keeps the same size however many cases there are; only the rail grows. Connection wires originating from a Switch handle render in vibrant purple (#8b5cf6) with dedicated branch badges (Payment Approved), making complex routing logic easy to audit visually.

Evaluation Target Is Required

A Switch in rules mode needs an evaluation target (the field or variable to evaluate), unless every case sets its own field; in expression mode it needs an expression. A Switch without one shows an amber ! marker on the canvas and does not run: its result is Error (“Switch has no evaluation target”) and the nodes behind it are skipped. The IF node follows the same rule for its condition.

Run Results

A Switch (and an IF) is a decision, not an HTTP request, so its run result shows a Decision view instead of Request / Response tabs:
  • Evaluated: the target and the value it resolved to, for example {{GetPet.response.status}} → 404.
  • Matched: the case that matched (Case 2 · 404 Not Found) or DEFAULT. For an IF: Result TRUE / FALSE.
  • Next: the node the flow continued with.
The raw output stays available under Raw output.

3. Intelligent DAG Condition Skipping

When the workflow executes:
  1. The engine evaluates Switch cases in sequential order until the first match succeeds.
  2. Downstream nodes belonging to the matching branch execute normally.
  3. Downstream nodes belonging to unchosen branches are automatically flagged as skipKind: "condition".
  4. Visual Dimming: On the canvas, skipped branches immediately dim to 35% opacity and 95% grayscale, giving operators immediate visual clarity on execution flow.

4. Convergent Downstream Nodes

If multiple branches converge back into a shared downstream node (e.g. an audit log step):
  • The engine guarantees that the convergent node executes as long as at least one active branch reaches it.
  • Unchosen skipped branches do not block the shared node.

5. Enterprise Decision Tree Patterns

Threshold-Based Approval Routing

Route requests dynamically based on transaction size or risk score:
  • Case 1 (Amount < 50,000): Routes directly to POST /transfers/auto-approve (Instant STP execution).
  • Case 2 (Amount >= 50,000): Routes to POST /compliance/queue-review (Manual officer review).
  • Default: Routes to POST /risk/flag-suspicious.
During runtime, the unchosen branches immediately gray out on the canvas, providing instant visual diagnostic proof of compliance routing without digging through server logs.