Text condition branching

Text conditions are a core technique for controlling how messages move through a flow. They allow a flow to make decisions based on the content of a message (message properties), most commonly a filename, status value, or document type indicator, and then route that message accordingly.

Common use cases include:

  • Routing files to different processing paths based on their name.

  • Classifying inputs or data before processing.

  • Selecting downstream behavior based on message content.

OL Connect Automate provides multiple ways to evaluate text and act on the result. Regardless of the technique used, the underlying principle is always the same:

  • evaluate a condition,

  • choose an output,

  • and continue processing.

This article focuses on best practices for handling text conditions using the switch node and the function node, as these are the two most commonly used and complementary approaches.

Text conditions results

A text condition does not stop or complete a flow. Instead, it determines where the message goes next. Depending on how the condition is defined, this can result in:

  • A binary decision

    The message follows one of two paths, for example, true/false or left/right.

  • Multiple branches

    The message is routed to one of several outputs, each representing a different condition.

  • A single effective output

    Matching messages continue, while non-matching messages are intentionally ignored, flushed, or routed to a separate handling path.

After the condition is evaluated, the flow continues as normal. The message may:

  • Be passed to connected nodes on the same canvas.

  • Be routed to shared logic using a link out node.

  • Jump to a different flow tab for further processing, using the link out node.

Choose the right node for text conditions

The table below summarizes common text condition scenarios and recommends whether a switch node or a function node is the better option.

Value(s) evaluated Scenario Recommended Node
Single value Two outputs for a binary comparison (match/otherwise). switch
Single value Multiple outputs, each representing a different condition, with fallback using 'otherwise'. switch
Single value Compare against multiple possible values and route to a true branch with a fallback . switch (JSONata or Regex)
Multiple values Complex logic or arbitrary number of outputs using JavaScript. function

Examples

See Switch node text condition examples and Function node text condition examples.