Ligantic
Knowledge Base
Tutorials
Updates
Search Articles
Login
Free Sign Up
Home
Get Started
Tutorials
How-to guides
Reference
Explanation
Spaces
Schemas
Flows
Experiences
Endpoints
SDK and CLI
Browse documentation
Home
Get Started
Spaces
Schemas
Flows
Experiences
Endpoints
SDK and CLI
Docs
/

Control - Switch

Type identifier: control:switch Category: 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

trigger

trigger

Yes

Execution trigger input

value

string or number

No

Value matched against configured cases

Data Mode (switchType: "data")

Handle

Data Type

Required

Description

value

string or number

No

Value matched against configured cases

case-{id}

any

No

Dynamic case input for each configured case

default

any

No

Fallback input when no case matches

Output Handles

Control Mode (switchType: "control")

Handle

Data Type

Description

case-{id}

trigger

Triggered when that case matches

default

trigger

Triggered when no case matches

Data Mode (switchType: "data")

Handle

Data Type

Description

value

any

Value from matched case input, or default

Configuration Options

Property

Type

Required

Default

Description

label

string

Yes

"Control - Switch"

Display label for the node

switchType

"control" | "data"

Yes

"control"

Mode: branching the run or routing data

inputType

"string" | "number"

No

"string"

Type used to normalise input and case values

caseSensitive

boolean

No

true

Case-sensitive matching in string mode

cases

Array<{ id: string; value: string | number }>

No

[]

Ordered list of match cases

Behaviour

Matching Semantics

  1. Resolves input from value.
  2. Normalises the input:

    • inputType: "number": converted to a number
    • inputType: "string": converted to a string; missing input becomes ""
  3. Scans cases in array order and selects the first match.
  4. 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} or default).
  • switchType: "data": reads matched input handle and sets output handle value.

Edge Cases

Scenario

Behaviour

Non-numeric input in number mode

Matches no case; routes to default

Empty/undefined input in string mode

Treated as empty string ""

Duplicate case values

First matching case wins

Data mode with unconnected matched handle

Output value becomes undefined

Examples

{
  "type": "control:switch",
  "data": {
    "label": "Route Status",
    "switchType": "control",
    "inputType": "string",
    "caseSensitive": false,
    "cases": [
      { "id": "ok", "value": "ok" },
      { "id": "retry", "value": "retry" }
    ]
  }
}

Related pages

Control - If
Conditional branching node that evaluates a boolean condition and directs the run down one of two paths. Supports both control flow mode (branching the run) and data mode (selecting between values).
Page not found. It may have moved or may not be published.
Browse documentation