Conditional Nodes¶
Unlike the analytic node types, conditional nodes provide flow control in graph processing. Conditional nodes provide a way to configure a graph to either run or skip some—or all—downstream nodes based on the values of runtime variables.
You can add conditional nodes between the analytic nodes in graphs, and write logic expressions that direct different outcomes depending on the evaluation of the conditions. Wherever a condition precedes a node, the system evaluates that condition to determine whether or not to process that node.
Conditional node files¶
Tip
Conditional nodes borrow the infrastructure of synchronize nodes.
Conditional nodes have a required description.json file and a notebook.json file for optional content.
A recipe's variation.json file records the condition details in a conditions-list object.
Conditional node operation logic¶
A conditional node operates with the following rules:
- Each condition can be set either to allow one or more nodes to process, or to block the process of one or more nodes.
- All conditional statements must resolve to Boolean values.
- Conditional statements cannot use variables from upstream test results, only from runtime or exported variables. A future feature release will add support for test results.
- A condition cannot execute the same node for more than one result of its evaluation in the initial release of this feature.
- Multiple conditions cannot be defined on the same conditional node. A future release will add support for multiple conditions combined by either AND or OR functions.
- Multiple conditional nodes can point to the same, single outgoing node. In this case, the execution of that single node is determined by all conditions combined by OR functions.
- Conditional statements do not support loops at this time.
Supported Boolean conditions¶
The result of a condition statement must be either true/success or false/failure.
- If...Then Statement (True Result Only): the comparison of the current value of a variable to another variable or static value using an operator
(==, >, >=, <, <=, !=) can be true or false, but outgoing node execution is only defined for results that are true. The false case is set to
execute "no outgoing nodes." This condition is processed as an
if...thenexpression. - If...Then...Else Statement (True or False Result): outgoing node execution is defined for both true and false results and processed as an
if...then...elseexpression. - If...Then...Else If Statement (Multiple Possible Results): outgoing node execution is defined for multiple results and processed as a
switch...caseexpression.
Visual example in Automation¶
The following image shows how conditions determine which nodes an order run will execute, based on the variable values set in the logic expressions.
