The condition node allows you to implement control-flow logic in your pipeline by creating multiple execution paths based on conditional statements. Use a condition node when you want certain nodes to execute only when specific conditions are met.

How to Use

  1. Click “+ Add Path” to create additional paths
  2. Customize the logic statement in each path
    • Input: the value you want to compare. Use: {{ to open the variable builder to reference values from other nodes.
    • Operator: the operation to do the comparison. See full list of operators in the next section.
    • Value: the comparison value.
  3. You can click “Add Clause” to build compound conditional statements within a path. Compound conditional statements are multiple clause logic statements combined with And / Or logic between them.
  1. Clauses are evaluated from top to bottom. The first path that evaluates as True will be the one that is taken.
  2. If no path executes as True, then “Path Else” is the one that will be taken.
  3. Connect the different downstream nodes to the different path depending on what you want to happen based on the logic.

Operators

  1. Comparison Operators:
    • Equal to (==)
    • Not equal to (!=)
    • Greater than (>)
    • Less than (<)
    • Greater than or equal to (>=)
    • Less than or equal to (<=)
  2. Text Operators:
    • Contains
    • Does Not Contain
    • Begins With
    • Does Not Begin With
    • Ends With
    • Does Not End With
    • Greater Than N Characters
    • Less Than N Characters
    • Is Empty
    • Is Not Empty
    • Is True
    • Is False
  3. List Operators:
    • List Contains
    • List Does Not Contain
  4. Map Operators:
    • Map Contains Key
  5. Expression
    • Custom Expression

Considerations

  • Clauses can be reordered by dragging within their condition group
  • Use a merge node to combine multiple conditional paths into a single flow (often used in chat flows before connecting to an output node)
  • The condition node doesn’t produce data outputs - it only controls which path executes
  • To access data from upstream nodes in nodes downstream of the condition node, reference the outputs of the upstream nodes.

Example

In the below example, we have a condition node with two paths.

  • If text_0 = hello, then path 0 will execute (which is false; text_0 = orange)
  • If text_1 = apple, then path 1 will execute (which is true)
  • Path 1 executes, and we merge both paths together before displaying the output. Path 1 is a text node that prints out text_1 (“apple”). Hence, the output is apple.