Switch Gate

The value-based router. Evaluates a single expression once and matches the result against multiple predefined cases, directing the trigger pulse to the matching output path.

Spec v1.1 Value Matcher

Port Overview

Input ports
eval
Switch Gate
Logic
Output ports
[caseLabel_1]
[caseLabel_N]
default
onError

Node Properties

Configuration for the value comparison. Unlike the Logic Gate, the Switch Gate evaluates its source expression once and performs a lookup against its cases for maximum performance.

SwitchGate

Routing Configuration

Property Type Default Description
expression expression required The value to evaluate (e.g., $.client.region or $.mqtt.payload.type).
matchMode enum Exact Exact — String or numeric equality.
Regex — Matches the expression result against a regular expression pattern.
NumericRange — Matches if the value falls within a range (e.g., 0-100).
cases array[obj] [] List of cases: { value: any, label: string }. The label becomes the output port name.
When to use Switch vs. Logic Gate Use the Switch Gate when you are routing based on a single categorical variable (e.g., Device Type, Region, Status Code). Use the Logic Gate when you need to evaluate multiple independent conditions (e.g., temp > 50 AND humidity < 20).

Port Detail

Releases control signals to dynamic output ports based on the value match.

Input ports
eval signal
The trigger signal. When pulsed, the node resolves the expression and finds the matching case.
Output ports
[caseLabel] signal
A dynamic port created for each case. Pulses if the expression result matches the case value.
default signal
Fires only if no cases match the expression result.
onError error
Fires if the expression cannot be resolved or if the match mode fails due to invalid syntax.