For Loop Node
Iterate over arrays and collections.
Overview
The For Loop node allows you to iterate over arrays and process each item. Results can be collected into a new array for use in subsequent nodes.
Configuration
| Field | Description | Required |
|---|---|---|
Input Data |
The array to iterate over (use variable syntax) | Yes |
Iteration Variable |
Variable name for the current item in each iteration | Yes |
Collector Variable |
Variable name to collect results from all iterations | No |
Example
Input Data: {{users}}
Iteration Variable: current_user
Collector Variable: processed_users
Inside the loop, access the current item with {{current_user}}
How It Works
- The loop receives an array from
Input Data - For each item, it sets the
Iteration Variableto the current item - Nodes inside the loop can access
{{iteration_variable}} - Results are collected into
Collector Variable(if specified)
Using Variables
Click the Insert Variable button to insert available variables from previous nodes:
{{api_response.items}}
{{scraped_data.links}}
{{datasource_results}}
Nested Properties
Access nested properties in your iteration variable:
{{current_user.name}}
{{current_user.email}}
{{current_user.profile.avatar}}
Best Practices
- Use descriptive iteration variable names (
current_ordernotitem) - Set a collector variable if you need to aggregate results
- Be mindful of rate limits when making API calls inside loops