Conditional execution in streams

With conditional execution you can control how terminal nodes are run, based on the stream contents matching conditions that you define; examples may include the following:

  • Based on whether a given value is true or false, control if a node will be run.
  • Define whether looping of nodes will be run in parallel or sequentially.

You set up the conditions to be met on the Conditional subtab of the stream Execution tab. To display the subtab, select the Looping/Conditional Execution execution mode.

Any conditional execution requirements that you define will take effect when you run the stream, if the Looping/Conditional Execution execution mode has been set. Optionally, you can generate the script code for your conditional execution requirements and paste it into the script editor by clicking Paste... in the bottom right corner of the Conditional subtab; the main Execution tab display changes to show the Default (optional script) execution mode with the script in the top part of the tab. This means that you can define conditions using the various looping dialog box options before generating a script that you can customize further in the script editor. Note that when you click Paste... any looping requirements you have defined will also be displayed in the generated script.

To set up a condition:

  1. In the right hand column of the Conditional subtab, click the Add New Condition button add a new condition button to open the Add Conditional Execution Statement dialog box. In this dialog you specify the condition that must be met in order for the node to be executed.
  2. In the Add Conditional Execution Statement dialog box, specify the following:
    1. Node. Select the node for which you want to set up conditional execution. Click the browse button to open the Select Node dialog and choose the node you want; if there are too many nodes listed you can filter the display to show nodes by one of the following categories: Export, Graph, Modeling, or Output node.
    2. Condition based on. Specify the condition that must be met for the node to be executed. You can choose from one of four options: Stream parameter, Global variable, Table output cell, or Always true. The details you enter in the bottom half of the dialog box are controlled by the condition you choose.
      • Stream parameter. Select the parameter from the list available and then choose the Operator for that parameter; for example, the operator may be More than, Equals, Less than, Between, and so on. You then enter the Value, or minimum and maximum values, depending on the operator.
      • Global variable. Select the variable from the list available; for example, this might include: Mean, Sum, Minimum value, Maximum value, or Standard deviation. You then select the Operator and values required.
      • Table output cell. Select the table node from the list available and then choose the Row and Column in the table. You then select the Operator and values required.
      • Always true. Select this option if the node must always be executed. If you select this option, there are no further parameters to select.
  3. Repeat steps 1 and 2 as often as required until you have set up all the conditions you require. The node you selected and the condition to be met before that node is executed are shown in the main body of the subtab in the Execute Node and If this condition is true columns respectively.
  4. By default, nodes and conditions are executed in the order they appear; to move a node and condition up or down the list, click on it to select it then use the up or down arrow in the right hand column of the subtab to change the order.

In addition, you can set the following options at the bottom of the Conditional subtab:

  • Evaluate all in order. Select this option to evaluate each condition in the order in which they are shown on the subtab. The nodes for which conditions have been found to be "True" will all be executed once all the conditions have been evaluated.
  • Execute one at a time. Only available if Evaluate all in order is selected. Selecting this means that if a condition is evaluated as "True", the node associated with that condition is executed before the next condition is evaluated.
  • Evaluate until first hit. Selecting this means that only the first node that returns a "True" evaluation from the conditions you specified will be run.