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.body.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
For each configured case, the Switch node renders a dedicated, labeled output handle on its right edge:
case-0: Connected to the first matching branch.
case-1, case-2…: Subsequent condition branches.
default: An optional fallback handle triggered when no preceding rules evaluate to true.
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.
3. Intelligent DAG Condition Skipping
When the workflow executes:
- The engine evaluates Switch cases in sequential order until the first match succeeds.
- Downstream nodes belonging to the matching branch execute normally.
- Downstream nodes belonging to unchosen branches are automatically flagged as
skipKind: "condition".
- 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.