Control - Switch
Type identifier:
control:switchCategory: Control Operations
Description
Routes the run or data based on a single input value matched against configured cases. Supports control-flow branching and data-selection modes.
Input Handles
Control Mode (switchType: "control")
Handle | Data Type | Required | Description |
|---|---|---|---|
|
| Yes | Execution trigger input |
|
| No | Value matched against configured cases |
Data Mode (switchType: "data")
Handle | Data Type | Required | Description |
|---|---|---|---|
|
| No | Value matched against configured cases |
|
| No | Dynamic case input for each configured case |
|
| No | Fallback input when no case matches |
Output Handles
Control Mode (switchType: "control")
Handle | Data Type | Description |
|---|---|---|
|
| Triggered when that case matches |
|
| Triggered when no case matches |
Data Mode (switchType: "data")
Handle | Data Type | Description |
|---|---|---|
|
| Value from matched case input, or |
Configuration Options
Property | Type | Required | Default | Description |
|---|---|---|---|---|
|
| Yes |
| Display label for the node |
|
| Yes |
| Mode: branching the run or routing data |
|
| No |
| Type used to normalise input and case values |
|
| No |
| Case-sensitive matching in string mode |
|
| No |
| Ordered list of match cases |
Behaviour
Matching Semantics
- Resolves input from
value. Normalises the input:
inputType: "number": converted to a numberinputType: "string": converted to a string; missing input becomes""
- Scans
casesin array order and selects the first match. - If no match exists, routes to
default.
Comparison Rules
- Number mode: the case value, as a number, must equal the input.
- String mode + case-sensitive: exact string equality
- String mode + case-insensitive: equal ignoring letter case and accents
Mode Behaviour
switchType: "control": triggers one output handle (case-{id}ordefault).switchType: "data": reads matched input handle and sets output handlevalue.
Edge Cases
Scenario | Behaviour |
|---|---|
Non-numeric input in number mode | Matches no case; routes to |
Empty/undefined input in string mode | Treated as empty string |
Duplicate case values | First matching case wins |
Data mode with unconnected matched handle | Output |
Examples
{
"type": "control:switch",
"data": {
"label": "Route Status",
"switchType": "control",
"inputType": "string",
"caseSensitive": false,
"cases": [
{ "id": "ok", "value": "ok" },
{ "id": "retry", "value": "retry" }
]
}
}