# Looping

Looping is beneficial for processing multiple items or actions repeatedly. Appizap Workflow Builder automatically handles repetitive processing, eliminating the need to manually include loops in workflows. However, there are some nodes where this automatic handling does not apply.

* Appizap Workflow Builder nodes can take multiple items as input, process them, and produce results.
* Each item can be seen as a single data point or row in the output table of a node.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2FO8VeuUYak71XimLcqWUr%2Fimage.png?alt=media&#x26;token=44749ef0-bd34-4d26-a377-0c4a9a9e5d8d" alt=""><figcaption></figcaption></figure>

Nodes typically run once per item. For instance, to share customer names and notes from the Customer Datastore node in a Slack message, follow these steps:

1. Connect the Slack node to the Customer Datastore node.
2. Configure the parameters.
3. Execute the node.

You would receive five messages: one for each item.

#### Executing nodes once <a href="#executing-nodes-once" id="executing-nodes-once"></a>

In cases where you only want a node to handle certain items, such as sending a Slack message to just the first customer, you can use the Execute Once parameter in the node's Settings tab. This parameter is useful when you have multiple items in the incoming data and only want to process the first item.

### Creating loops <a href="#creating-loops" id="creating-loops"></a>

Appizap Workflow Builder usually manages the iteration of incoming items. But sometimes you might need to create a loop to iterate through all items. Check Node exceptions for nodes that don't automatically iterate over all incoming items.

To make a loop in an Appizap Workflow Builder workflow, link one node's output to the previous node's input. Include an IF node to determine when to end the loop.

[Refer sample here](https://n8n.io/workflows/1130?_gl=1*1adbo6t*_gcl_au*MTgyMDQ5NDMwMi4xNzE1MzQxMTgw*_ga*MTU2MDY2MzUyMC4xNzE5NDgzMzA4*_ga_0SC4FF2FH9*MTcyMTc5OTE1Ni4xMy4xLjE3MjE4MDA2NDkuNTguMC4w)

The Loop Over Items node is used to loop through all items for processing. Set Batch Size to 1 to process each item individually.

You can group data and process it in batches to avoid API rate limits when handling large amounts of data or specific items.

The Loop Over Items node stops running when items are divided into batches and sent to the next node. Adding an IF node to stop the loop is not needed.

### Node exceptions <a href="#node-exceptions" id="node-exceptions"></a>

* [CrateDB](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.cratedb/) executes once for `insert` and `update`.
* [Code](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/) node in **Run Once for All Items** mode: processes all the items based on the entered code snippet.
* [Execute Workflow](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflow/) node in **Run Once for All Items** mode.
* [HTTP Request](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/): you must handle pagination yourself. If your API call returns paginated results you must create a loop to fetch one page at a time.
* [Microsoft SQL](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.microsoftsql/) executes once for `insert`, `update`, and `delete`.
* [MongoDB](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.mongodb/) executes once for `insert` and `update`.
* [QuestDB](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.questdb/) executes once for `insert`.
* [Redis](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.redis/):
  * Info: this operation executes only once, regardless of the number of items in the incoming data.
* [TimescaleDB](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.timescaledb/) executes once for `insert` and `update`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appizap.ae/appizap-workflow-builder-pro/build-flow-logic/looping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
