Decision units

Learn how to use decision units to control data flow

Decision units allow you to create branches to control the data flow based on formulas.

When you add a Decision unit to a pipeline, you define a branch by using 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.

Pipeline with a Decision unit and two branches with data sources

To add the Decision unit as shown in the pipeline above, follow these steps.

Steps
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 alpha users

    2. Branch condition - for example request.path.user_type = "alpha" 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 beta users

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

  8. Connect the branch alpha users to a data source using the connection point and from the Select unit to place pane.

  9. Connect the beta users to a data source using the connection point and the Select unit to place pane.

  10. Click Done to save your changes.

Example
Example
Decision unit - create new branch
First branch name and condition
Second branch name and condition
Decision branches added
Decision unit added

Merging multiple decision units

Sometimes you may need to put a Merge unit after a set of 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.

In the following example, a Merge unit is placed after two sets of Decision units. The logiic of this pipeline does not require one branch of a Decision unit to use the Merge unit.

Example
Example