Table of Contents

Router

Block Group: Logic
Icon:Router block icon

The Router block forwards an event to a destination, which is selected by evaluating an input condition. The important differences between the Router block and the Case block are (1) the Router block provides multiple exit points, while the Case block has a single exit and (2) the Router block is bound to an event.

For information on using dataflow blocks, see Dataflow.


Input/Output Properties

The following properties of the Router block can take input and give output.

op specifies the arithmetic, comparison, or text operator to be applied to the input to test against the specified cases. When the operation evaluates to TRUE, the corresponding case block is executed.

condition is the incoming value that is to be compared with each test value.

event specifies the event that triggers the block. You can bind only a single event to a Router block. If you want several different types of events to trigger the same Router block, use a Hub block to coalesce the events to a single output event.

singleOutput When singleOutput is set to TRUE, all outputs but the result are set to null when an event is routed. By default, outputs retain their value between evaluations.

case n specifies a test value to compare with the incoming condition.


Output Property

The following properties of the Router block can give output but cannot take input.

output n the value to be forwarded if the case evaluates to TRUE. The output can be forwarded to multiple destinations.

else specifies the value to be forwarded if none of the expressions evaluates to TRUE.


Examples

If a Router block contains the following logic and its event is bound to the onMouseClick event for a button, then when a user clicks the button, the Router logic evaluates the value of the condition and calls one of three scripts according to the result.