Switch
Route by a value: one out-port per case, then otherwise.
Routes data to the out-port of the first case whose match equals value, or to otherwise.
Each case owns a port minted with it, so adding a case adds a port. dataKind sets the kind of every routed port at once — a Switch carries frames or JSON, not a mixture. Exactly one port emits, and the rest emit nothing at all, which is what lets the branches that did not fire be skipped rather than run.
At a glance
Module type
Switch
Category
Primitives · Control
Default tier
reactive
Runs on
reactive, durable
Starts a flow
no
Holds a body
no
Keeps state between runs
no
Available in
every application type
Parameters
dataKind
"json" | "dataframe" · required · defaults to "dataframe"
The kind every routed port carries; a Switch routes frames or JSON, not a mixture.
cases
object[] · required · defaults to [{"match":"","portId":"<minted per module>"}]
The cases, tried in order; each owns the out-port minted with it.
Inputs
on
event
no
Implicit on every module that does not itself start a flow: wire an event here to make this module the start of what that event runs.
value
scalar
yes
The value the cases are matched against.
data
dataframe
no
What is routed; unconnected, the ports carry the value itself.
Outputs
case_<caseId>
dataframe
dataframe, signal
The routed payload, on the port of the case that matched.
otherwise
dataframe
dataframe, signal
The routed payload, when no case matched.
Last updated

