Multi Port Switch
This function block routes one of many incoming values to its output based on a reference selector. Use it when you want to pick a single input stream (or value) from a configurable list at runtime.
π₯ Inputs
Switch Accepts a selector value. This can be:
a single number (selects the input at that index), or
a boolean/list of booleans (selects the first input where the value is TRUE).
Input 0, Input 1, ... Additional generic inputs. The number of available inputs is adjustable via the block controls.
(Each of the above are input sockets on the block.)
π€ Outputs
Generic The output forwards the data coming from the selected input socket.
(This is the output socket on the block.)
πΉοΈ Controls
Number of inputs A dropdown that lets you choose how many input sockets the block exposes (more inputs appear or are removed accordingly).
(Use this control to adapt the block to your scenario β from a few inputs up to the configured maximum.)
βοΈ Running mechanism
The block reads the value provided to
Switchand determines which input to route.If
Switchis a number, the block routes the input at that numeric index.If
Switchis a boolean list, the block finds the first TRUE entry and routes the corresponding input.If the selected input is not connected or empty, the block reports an invalid selection and does not forward a value.
This behavior makes the block suitable for runtime decision-making and conditional routing in visual flows.
β¨ Features
Dynamic input count: Add or remove inputs from the UI without redesigning the flow.
Accepts numeric or boolean selectors for flexible control.
Generic input/output sockets: works with images, numbers, text, lists, or other data types.
π Usage Instructions
Set the desired number of inputs with
Number of inputs.Provide values to the corresponding
Input Xsockets.Drive the
Switchsocket with a numeric selector (useNumber Input) or a boolean/list selector (useLogic Inputor other logic-producing blocks).Read the routed value from the
Genericoutput.
π‘ Tips and Tricks
Use
Number Inputto manually choose an input index during testing.Use
Logic Inputor logical operators such asAnd/Orto generate boolean selectors for theSwitchsocket.Combine with
MuxorDemuxwhen converting between grouped/listed data and individual sockets. For example, gather values into a list withDemuxthen use a boolean list to select one with this block.Use
Data Memoryto hold a selected value and feed it back as a stable input to the block.Place this block before
Show Imageto switch which image source is displayed, or before an analysis block likeFind Objectto test different image inputs quickly.In automation flows, combine with
Subsystem EnabledorSet - Resetto switch sources depending on system state.
(hint: recommended companion blocks include Number Input, Logic Input, Mux, Demux, Data Memory, Show Image, and Find Object.)
π οΈ Troubleshooting
If nothing appears on the output, check that the selected input socket is connected and that
Switchpoints to the correct index or TRUE entry.If selection jumps unexpectedly, verify the source driving
Switch(it may be changing each cycle). UseData Memoryto stabilize the selector if needed.If you need more inputs than currently available, increase the count with
Number of inputsand reconnect your sources.
Last updated
Was this helpful?