Router

The Router piece allows you to create conditional branches in your workflow, directing the flow based on specific conditions.

How to Use the Router Piece in ZBrain Flow?

Step 1: Select Router as Your Connection

  • Click on the '+' button in the Flow and search for Router.

  • Select Router.

Step 2: Configure Execution Behavior

After adding the Router piece to your workflow, you'll see it creates two default paths: "Branch 1" and "Otherwise." The Router will evaluate conditions and direct your flow accordingly.

Under the ‘Execute’ dropdown, choose how you want multiple conditions to be handled:

  • Only the first (left) matching branch: This option creates an exclusive branching pattern. The Router evaluates branches from left to right, and as soon as it finds a branch with conditions that evaluate to true, it executes only that branch and stops checking further branches. This is similar to a switch statement in programming, where the first matching case is executed, and the rest are ignored unless explicitly configured otherwise.

  • All matching paths from left to right: This option allows multiple branches to execute in parallel if their conditions are met. The Router evaluates all branches from left to right, and any branch whose conditions are evaluated to true will be executed. This behavior is more like having multiple independent "if" statements.

Step 3: Set Up Branch Conditions

Click on the ‘Branch’ option to configure its condition:

  1. When configuring a branch, you'll see these condition options:

    1. In the ‘Execute If’ section:

      • First value: Enter the value or variable to evaluate

      • Operator: Select from dropdown options including:

        • Contains

        • (Text) Does not contain

        • (Text) Exactly matches

        • (Text) Does not exactly match

        • And many other comparison options

        • Exists

        • (List) Is empty

        • And many other comparison operators based on data type

      • Second value: Enter the comparison value (if applicable)

    2. For multiple conditions:

      • Use ‘And If’ section to add conditions

      • Each additional condition has its own set of:

        • First value field

        • Operator dropdown (like "(List) Is empty")

        • Second value field (when applicable)

    3. Condition management:

      • Click on ‘Remove’ button to delete a specific condition

      • Press the ‘+ And’ button to add another required condition

      • Use '+ Or' button to add an alternative condition

    This allows you to build complex conditional logic with multiple variables and operators to precisely control your workflow's branching behavior.

Step 4: Add More Branches If Needed

Click the '+' button to create additional conditional paths beyond the default two.

Last updated