# Conditions

Value Stream Modeller provides several features that let you control when steps run and how the workflow progresses. Using conditions, you can restrict steps to specific events, create branching logic, or repeat parts of the process until a requirement is met. These mechanisms allow you to build workflows that adapt dynamically to different scenarios.

<table data-view="cards"><thead><tr><th align="center"></th><th align="center"></th><th align="center"></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><i class="fa-filter">:filter:</i></td><td align="center"><strong>Step filters</strong></td><td align="center">Run a trigger or step only when the event type matches your filter (OR/AND).</td><td></td><td></td><td><a href="#step-filters">#step-filters</a></td></tr><tr><td align="center"><i class="fa-code-branch">:code-branch:</i></td><td align="center"><strong>Conditional steps</strong></td><td align="center">Create branches with different paths that run when their conditions are met.</td><td></td><td></td><td><a href="#conditional-steps">#conditional-steps</a></td></tr><tr><td align="center"><i class="fa-repeat">:repeat:</i></td><td align="center"><strong>Looping</strong></td><td align="center">Repeat steps until a condition is met, then continue to the next step.</td><td></td><td></td><td><a href="#iterator-steps">#iterator-steps</a></td></tr></tbody></table>

## Step filters

Filters allow a trigger or a process step to act only on specific event types. When a filter is applied, the step runs only if the filter conditions are met. If the conditions are not met, the step is skipped. Filters are based on the event types configured in OE for your tenant.

### Adding a step filter

To open and configure filter settings:

{% stepper %}
{% step %}

#### Choose the process step

Use the three dots icon in the process step where you want to add a filter and choose **Add Step Filter**.
{% endstep %}

{% step %}

#### Configure the filter

* Select the **Field** - currently the Event Type is supported.
* Choose the filter **Operator**:
  * OR: The condition applies if the event type matches at least one of the selected events.
  * AND: The condition applies only if the event type matches all selected events. Events accumulate across steps.
* Choose the **Events** from the drop-down list. The list shows event types available for your tenant and the current scenario context. You can select multiple event types at one time.

For example:

If you select OR with `Customer opt in` and `Customer created` selected, the filter passes if either one happens. If you select AND with the same list, the filter only passes once both events happen.
{% endstep %}
{% endstepper %}

When a filter is configured, an additional filter block appears below the step where it was applied. You can cancel the configuration at any time or remove an existing filter from the process step.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-70afa7ef01608d1fccd80afc663c14bd950da6a5%2Ffilter.png?alt=media" alt="" width="500"><figcaption><p>Step filter block shown below the process step</p></figcaption></figure>

## Conditional steps

Conditional steps let you introduce branching logic into a workflow, allowing different sets of steps to run depending on whether specific conditions are met.

You define one or more paths, each with its own condition. When the workflow reaches the conditional step, the system evaluates every path’s condition:

* If a condition is true, its corresponding path is executed.
* If there are multiple conditions set, the paths run in parallel.
* If no conditions are met, the conditional step is skipped and the workflow continues to the next step in the main sequence.
* To complete the conditional step, all of the conditions set up in the paths have to be met.

This enables logic similar to if and if/else statements and allows flexible routing within the workflow.

Each path contains an array of steps that run sequentially, one after another. These steps use the same structure and format as standard workflow steps in the value streams, ensuring consistency across the process.

**Example:**

When a customer places an order, the process can send them a coupon - but under different circumstances:

* When the customer belongs to the **Premium Customers** segment, or is a first time customer
* When the delivery is late because of the order splitting.

If both conditions are met, the customer receives an email with a voucher for their next order. If not, that path is skipped and the process continues without sending the coupon.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-1ed69acde6792cddeb9158d9f0d85c45fd510a6c%2Fconditional_step.png?alt=media" alt=""><figcaption><p>Conditional step with two paths</p></figcaption></figure>

### Creating a conditional step

{% stepper %}
{% step %}

#### Add a conditional step

Add a new process step and choose **Condition**. The conditional step is added to your flow.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-e221355085cbb026012974781f709b499e84b5cd%2Fconditional_step1.png?alt=media" alt=""><figcaption><p>Conditional step</p></figcaption></figure>
{% endstep %}

{% step %}

#### Define paths and conditions

A sidebar opens where you define the conditions for each path. Each condition becomes a separate path (branch) of the conditional step. Define the variables for each path and save.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-86992bfa3f445c942d2e251f993d480d5193b89d%2Fconditional_paths.png?alt=media" alt=""><figcaption><p>Conditional step empty paths</p></figcaption></figure>

In this example, two paths are set up: one condition checks whether the customer belongs to a specific segment, the other checks whether the order contains more than a 100 of product items.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-524f02fcb54c2da515799410cd850313776c76cb%2Fconditional_paths2.png?alt=media" alt=""><figcaption><p>Conditional step with two variables in paths</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add steps inside each path

For each path you can add steps that run when that path’s condition is met. For example:

* If the customer belongs to a Premium Customers segment, they get an email with a coupon for the next order.
* If the order has more than 100 items, the order needs to be split, but if it turns out the delivery is late and takes more than 5 days, the customer also gets a coupon for the next order.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-64d170587776e51ab2bee138bce6a15cd18b6ec3%2Fconditional_paths3.png?alt=media" alt=""><figcaption><p>Conditional step with a step</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add a step after the conditional step

Add a step that runs after the conditional checks. This step is executed only when at least one of the defined conditions is satisfied and its path leads to it. If no condition is met, the process does not continue.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-1ed69acde6792cddeb9158d9f0d85c45fd510a6c%2Fconditional_step.png?alt=media" alt=""><figcaption><p>Conditional step with two paths</p></figcaption></figure>
{% endstep %}
{% endstepper %}

For each path you can **Add Predicate** to refine when the path runs by combining conditions with AND or OR logic. For example, on the customer check path you can add a predicate so the path runs either for the first-time customers, or when the customer is in the Premium Customers segment.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-7bcaaf99cb99a22c74eeda8c8660a213861109db%2Fcondition_double.png?alt=media" alt=""><figcaption><p>Additional predicate configuration</p></figcaption></figure>

## Iterator steps

With the iterator step, you set up a loop that repeats the steps inside it until a defined condition is satisfied. After each iteration, the system evaluates the loop condition:

* If the condition is false, the loop runs again.
* If the condition is true, the loop ends and the workflow continues with the next step outside the loop.

### Loop execution

In a linear workflow (without branching), the system executes all steps inside the loop sequentially. After the steps finish, the loop condition is evaluated. The cycle repeats until the condition becomes true, at which point the workflow proceeds to the next step in the sequence. By default, the loop can be inifite, but you can also define the number of its runs by setting up the **Limit**.

**Examples:**

* You can set up a value stream that is triggered by a product price update: the product is updated with the new price, and when the price decreases by 20% or more, an email is sent to customers about a final offer. The loop evaluates the price and, based on the condition, triggers the step that sends the email.

  <figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-a150ec15c465f454b9a65b3a49a39115fb2c458c%2Fprice_loop.png?alt=media" alt=""><figcaption><p>Value stream with a loop</p></figcaption></figure>

  Loops can also be used in paths, inside the conditional steps. It means, each path may contain its own steps, including loops. When a path is executed, any loop within that path behaves the same way–its internal steps repeat until the loop condition is met, after which the path continues with its remaining steps.
* You can create a value stream for return management where the conditions check whether the return was requested within 14 days of the order, and whether the order value is above or below $200. If it is below $200, the system automatically approves the return. If it is above $200, the process retrieves the approval group members and then waits for approval; a loop in the approval path runs until approval is received.

  <figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-4c79c5904dfd7c374b4ae2a1bd30330e1a38ad3c%2Freturn_condition.png?alt=media" alt=""><figcaption><p>Value stream for returns management</p></figcaption></figure>

  If a loop is added in the conditional step's path, and has conditions set up, it overrides the conditional steps ones defined for the path.

{% hint style="info" %}
For step-by-step guidance on building value streams, see [Creating a Value Stream](https://developer.emporix.io/value-stream-modeller/value-stream-designer/creating-value-stream).
{% endhint %}
