Router
Introduction
The Router provides the ability to send a stored value to one of many outputs depending on the evaluation of its associated condition. For example, you may want to route a variable "x" to different outputs depending on whether it 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" as the Router's stored value and sending to both conditions will cause the second condition to evaluate to true and "x" to be sent to only the second condition's 'Get Output Value' connector.
Defining Conditions
Before a Router 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. For each condition, a "Set [x]" input connector for each variable specified in the expression and a single "Get Output Value" output connector are dynamically created. The first condition that first evaluates to true has the Router's input value sent to its "Get Output Value" connector.
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 data 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:
Set Input Value
The value that is routed to the different output connectors depending on the conditions.
Accepted Datatypes:
- Any
- Any value can be routed through this module.
Triggered Outputs:
- Output Message:
- Get Output Value
Defined Conditions → [Condition n] → Set [x] (Dynamic Menu)
This input connector sets the value of the specified variable in a condition of the Router.
Accepted Datatypes:
- Any
- The incoming type must match the type defined for the variable in the property panel.
Triggered Outputs:
- Output Message:
- Get Output Value
Output Menu:
Defined Conditions → [Condition n] → Get Output Value
Outputs the value set as the input if the condition is the first one that evaluates to true.
Output Datatype:
- Any
Triggered By:
- Input Message:
- Set Input Value
- Input Message:
- Defined Conditions → [Condition n] → Set [x]
- Action:
- Fire-On-Connect