Skip to Content

Switch

Introduction

The Switch provides the ability to select among multiple incoming values and choose only one to output based on the evaluation of its associated condition. For example, you may want to output different text depending on whether a variable "x" is positive or negative. To do this, you can setup two conditions: one evaluating if "x" is greater than zero, and another evaluating if "x" is less than zero. Inputting a negative "x" to both conditions will cause the second condition to evaluate to true and thus trigger the output of its associated message.

Defining Conditions

Before a Switch can be used, it must first have its conditions specified in the property panel. These conditions are expressions similar to those used in the Formula, but they must evaluate to either true or false. The first condition that evaluates to true has its input value sent to the "Get Output Value" output connector. For each condition, an associated input menu is dynamically created containing a 'Set Input Value' connector as well as a 'Set Value' connector for each variable specified in the expression.

Property Panel:

Manage Conditions
Condition Name
The condition name. Double click the name to edit it.
Expression
The current expression set for this condition. This expression is defined below.
Valid
Whether the condition is enabled or not. This depends on its expression being syntactically correct and the types of its variables having been defined.
Up
Moves the selected condition up in the list.
Down
Moves the selected condition down in the list.
New Condition
Adds a new condition.
Remove Condition
Deletes the selected condition.
Edit Expression
The expression for the selected condition is defined here. The condition must be syntactically correct and evaluate to true or false.
Edit Variable Parameters

Variables in the condition's expression are automatically detected and displayed. In order for a condition to be 'enabled', it must have a data type assigned to each of its variables.

Variable
The name of the detected variable in the expression.
Data Type
Specify the data type of the variable here.
Value
The current value of the variable.
Test Condition
Press this button to see the result of the selected condition's expression with the current variable values.

Input Menu:

[Condition n] → Set Input Value

Sets the value that is output if [Condition n] is the first condition to evaluate to true.

Accepted Datatypes:
Any
A message of any type.
Triggered Outputs:
Output Message:
Get Output Value
[Condition n] → Set [x] (Dynamic Menu)

This input connector sets the value of the specified variable [x] in [Condition n] of the Switch.

Accepted Datatypes:
Any
This type must match the type defined for the variable in the property panel.
Triggered Outputs:
Output Message:
Get Output Value

Output Menu:

Get Output Value

Outputs the value set as the input associated with the first matching condition.

Output Datatype:
Any
Triggered By:
Input Message:
[Condition n] → Set Input Value
Input Message:
[Condition n] → Set [x]
Action:
Fire-On-Connect