---
title: "Branch, filter, loop and transform in workflows"
description: "Make decisions and repeat work in a Softr workflow: branch on a condition, filter a run, loop over a list of items, and transform data between your steps."
canonical: "https://docs.softr.io/workflows/logic"
updated: "2026-12-04"
---

# Branch, filter, loop and transform in workflows

Workflows can make decisions and repeat work. A branch picks a path. A filter stops the run when a condition fails. A loop repeats steps for each item in a list. A transform reshapes data between steps.

To use data from earlier steps in these settings, see [Map data between steps](/workflows/map-data).

## Branch

The **Branches** step splits the run into several paths, named A, B, C and so on. Each path starts with its own condition. Every path whose condition is met runs, at the same time as the others. A path whose condition is not met stops there.

1. Add a **Branches** step.
2. Select a path on the canvas, then set its condition, such as **category** **is** **Billing**.
3. Select **Add** in the **Branches** settings to add another path.

![The Branches settings: All qualifying branches will run in parallel, then the paths A Billing, outlined, B Technical and C Sales, each Conditional, and Add](/workflows/logic/branches.2x.webp)

![The settings of the Billing path: Only continue if... the category of step 2 is Billing](/workflows/logic/branch-condition.2x.webp)

For example, after an AI step sorts a request, send billing requests to Slack, assign technical ones to support, and email the sales lead about the others.

If no condition is met, no path runs. To handle every other case, add a path with the opposite condition. Paths don't join again: if two paths need the same step, add it to each path.

Combine branches with AI steps to route a run on an AI result. See [Route a run with AI](/workflows/ai#route-a-run-with-ai).

## Filter

The **Filter** action checks a condition and stops the workflow if the condition is not met. Use it when nothing needs to happen in the "no" case.

For example, a workflow triggers on every new record of a table. Add a Filter at the start that stops the run when the record's "Status" is not "Ready". Only "Ready" records continue.

Unlike **Branches**, **Filter** doesn't create paths. It stops the run early. Each path of a **Branches** step starts with a filter like this one.

## Loop

The **Bulk actions (Loop)** step runs a group of steps once for each item in a list. It needs a Basic plan or higher.

To set up a loop:

1. Under **List to run actions for**, pick a list of items, such as the records a **Find multiple records** step returns.
2. Add the actions that run once per item inside the loop.
3. Inside the loop, pick the current item's fields under the loop step in the variable picker.

After the last item, the workflow continues with the next action after the loop.

![A workflow that runs every Monday, finds the unpaid invoices, then runs two steps for each invoice inside a Bulk actions (Loop) step: Format the amount and Email the client. The loop settings are open, with List to run actions for set to the Records of step 2, outlined](/workflows/logic/loop.2x.webp)

For example, find all "Pending" orders, then loop over them and email each customer a status update.

### When items fail

A step inside the loop can fail for one item, for example when the item has no record ID. The loop then goes on with the next item.

- If at least one item runs without a failure, the loop succeeds and the workflow continues after it. The `failedIterations` output of the loop tells you how many items failed.
- If every item fails, the loop fails with the message `Every iteration of the loop failed (3 of 3). Last error: ...`. The workflow stops after the loop, and the run counts as failed. You get the failure email, and after 5 failed runs in a row the workflow turns off.
- To let the workflow go on after a loop where every item failed, turn on **Continue on error** in the loop settings.

A failure that a path of the failed step handles, such as **Continue on error** on that step, does not count as a failed item.

When you test the loop in the builder, the test follows the same rule for the items it runs.

### Nested loops

Place a **Loop** inside another **Loop** when each item of the outer list contains its own list.

For example, you have a list of tasks, and each task has several tags. You want one record per task and tag combination.

```
Loop Tasks
└── Loop Tags of this Task
        └── Create record (Task + Tag)
└── Mark Task as checked
```

If a task has 3 tags, the inner loop runs 3 times and creates 3 records for that task. The outer loop then moves on to the next task. You can nest more than two levels.

> **Tip**
>
> Every action inside a loop runs once per item, which affects speed and the actions your plan includes. Keep the list small with a **Filter** or with conditions on your **Find multiple records** step.

A loop runs at most 500 times per run. In a test run, it runs 5 times.

## Transform data

The **Transform data** action creates new values with formulas, the same syntax as the formula fields of Softr Databases. See [Formula reference](/databases/formulas). Use it to reshape, calculate or extract data between steps.

For example:

- Increment a counter: `{vote_count} + 1`.
- Get the day of the week from a date: `WEEKDAY({submission_date})`.
- Return different values for a condition: `IF()`.

You name each output field yourself, and select **Add field** to add another. The names become variables in later steps. Select **Help me write a formula** to let AI write the formula from a description.

![The Transform data step Format the amount, with one output field named amount and its Formula outlined: a dollar sign joined to the Amount of the current invoice. Below is Help me write a formula](/workflows/logic/transform-data.2x.webp)

### Transform data or run custom code

|          | Transform data                                        | Run custom code                                         |
| -------- | ----------------------------------------------------- | ------------------------------------------------------- |
| Best for | Simple calculations, text formatting, date operations | Complex logic, JSON parsing, multi-step transformations |
| Syntax   | Softr formula language                                | JavaScript or Python                                    |
| Setup    | Write a formula                                       | Define input variables, write code                      |
| Plan     | All plans                                             | Pro plan and higher                                     |

For example, an "Upvote" button starts a workflow. Find the record to read its `vote_count`, use **Transform data** with `{vote_count} + 1`, then update the record with the new value.

For logic that these steps cannot express, write it in JavaScript or Python with [Run custom code](/workflows/run-custom-code).
