Decision units

Learn how to use decision units to control data flow

A Decision unit is used to create branches to control the data flow based on formulas. When a Decision unit is added to a pipeline, each branch is defined by a condition that resolves to either true or false.

Branch conditions can use formulas. When a condition resolves to true, then the associated branch is executed and the pipeline data flow follows the associated sub-pipeline.

Only one branch can resolve to true. All others must resolve to false, otherwise the pipeline will give an error.

The following screenshot shows a pipeline with a Decision unit with two branches.

Decision unit in a pipeline
Decision unit in Mapping editor

To add the Decision unit, follow these steps.

  1. In the Pipeline dashboard, select Decision unit from the Library to add it to the pipeline.

  2. Drag a line from a unit to the new Decision unit.

  3. Click the Decision unit open the Mapping Editor.

  4. Click Create new branch to add the first branch.

  5. In the new branch, enter the following:

    1. Branch name - for example is-xapix-vehicle.

    2. Branch condition - for example request.path.type = "xapix" Note: Conditions are similar to formulas except it must resolve to "true" to be executed.

  6. Click the Plus (+) sign to add a second branch.

  7. In the second branch, enter the following:

    1. Branch name - for example is-delivery-vehicle

    2. Branch condition - for example, request.path.type = "delivery-vehicle". Note: Both branches cannot resolve to "true".

  8. Click Done to close the Mapping editor.

  9. On the Pipeline dashboard, connect the branch is-xapix-vehicles to a data source unit.

  10. Connect the branch is-delivery-vehicles to another data source unit.

  11. Click the Decision unit to view the completed mapping in the Mapping editor.

  12. Click Done to save your changes.

Merging multiple decision units

Sometimes you may need to put a Merge unit after using a Decision units. In these instances, without a Merge unit, data from only one of the Decision units will be appear in the pipeline transformation. This may be the desired behavior you want, If not, add a Merge unit afterwards to have results from both branches to be present.

See Merge units for more details.