Type/to search
Nodes
Manual Trigger
Schedule Trigger
RSS Feed Trigger
Kline Close Trigger
Discord Trigger
Telegram Trigger
Slack Trigger
AI Agent
Sentiment Analysis
MCP Client
OpenAI Model
Anthropic Chat Model
Code Tool
HTTP Request Tool
MCP Client Tool
Code
HTTP Request
Edit Fields (Set)
Filter
IF
Loop Over Items
Merge
Aggregate
Compare Datasets
Convert to File
Crypto
Database
Extract from File
HTML
Limit
Log
No Operation, do nothing
RSS Read
Read Files from Disk
Remove Duplicates
Rename Keys
S3
Sort
Split Out
Stop And Error
Summarize
Switch
Telegram
Wait
Write Files To Disk
XML
App push
DingTalk Robot
Discord Bot
Email
Feishu Custom Bot
Slack
Account Info
Market Info
Trading Executor
Indicator
Trading Plugin
Credentials


The Loop Over Items node enables you to iterate through data when required.

The node preserves the original incoming data and returns a predefined amount of data through the loop output with each iteration.

Upon completion, the node consolidates all processed data and returns it through the done output.

When to use the Loop Over Items node

By default, nodes process lists of input items automatically (with some exceptions detailed below). Depending on your requirements, you often don't need the Loop Over Items node in your workflow.

These resources highlight scenarios where the Loop Over Items node proves useful:

  • Loop until all items are processed: explains how the Loop Over Items node differs from standard item processing and when to incorporate it.
  • Node exceptions: describes specific cases and nodes where you need to implement manual looping logic using the Loop Over Items node.
  • Avoiding rate limiting: demonstrates how to batch API requests to prevent rate limits from external services.

Node parameters

Batch Size

Specifies the number of items to return with each iteration.

Node options

Reset

When enabled, the node reinitializes with the current input data at each loop iteration. Use this option when you want the Loop Over Items node to treat incoming data as a new dataset rather than a continuation of previous items.

For example, you can combine the Loop Over Items node with the reset option and an If node to query paginated services when the total page count is unknown. The loop queries pages sequentially, processes the data, and increments the page number. The reset functionality ensures each iteration recognizes the data as new. The If node evaluates an exit condition to determine whether to continue iterating.

For workflows implementing this pattern, you must include a valid termination condition. Without a proper termination condition, your workflow will enter an infinite loop.

When enabled, you can customize reset conditions by changing the parameter representation from Fixed to Expression. The expression's evaluation result determines when the node resets item processing.

Templates and examples

This workflow demonstrates reading RSS feeds from two different sources using the Loop Over Items node. The Loop Over Items node is necessary because the RSS Feed Read node only processes the first item it receives. You can also find the workflow.

This example guides you through building the workflow, assuming familiarity with basic concepts. For your first workflow, including node addition instructions, refer to Try it out.

  1. Add the manual trigger.
  2. Add the Code node.
  3. Copy this code into the Code node:
    javascript
    return [ { json: { url: "https://medium.com/feed/@fmzquant", }, }, { json: { url: "https://dev.to/feed/googlecloud", }, }, ];
  4. Add the Loop Over Items node.
  5. Configure Loop Over Items: set the Batch Size field to 1.
  6. Add the RSS Feed Read node.
  7. Select Execute Workflow to run the workflow and load data into the RSS Feed Read node.
  8. Configure RSS Feed Read: map url from the input to the URL field. You can drag and drop from the INPUT panel or use this expression: {{ $json.url }}.
  9. Select Execute Workflow to run the workflow and view the results.
Check whether the node has processed all items

To verify if the node has remaining items to process, use the following expression: {{$node["Loop Over Items"].context["noItemsLeft"]}}. This expression returns a boolean value: false if items remain, true if processing is complete.

Get the current running index of the node

To retrieve the current iteration index, use the following expression: {{$node["Loop Over Items"].context["currentRunIndex"];}}.

Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)