Diaflow's Documentation
HomePricingIntegrations
Documentation
Documentation
  • 😎WELCOME TO DIAFLOW
    • Introduction to Generative AI
    • What can you build with Diaflow?
  • 💻USER ACCOUNT
    • Create your user account
    • Delete your user account
    • Log out and log in
    • Change "Personal" & "Workspace" settings
    • Reset user account password
  • 🚀Getting Started
    • Let's start with the basics
      • How a component works?
      • How a flow works?
      • Creating your first flow
    • Dashboard
      • Services
      • Create a flow from scratch
      • Create a flow from templates
      • View your flows
    • Terminology
  • 🌊Flows
    • Overview
    • Create a flow
    • Delete a flow
    • Manage a flow
    • Publish a flow
    • Unpublish a flow
    • Deployment
    • Component Reference
      • Trigger
        • When inputs are submitted (Apps)
        • Cronjob (Automation)
        • Webhook (Automation)
        • Microsoft Outlook (Automation)
      • Outputs (Apps)
        • Text Output
        • Chart Output
        • Video Output
        • Audio Output
        • Image Output
      • Built in tools
        • Branch
        • Merge (Multiple data source to JSON)
        • Split Data (JSON Formatter)
        • Video to audio
        • Get current date and time
        • Web scraper
        • Document to plain text
        • Retrieve data from spreadsheet (Spreadsheet analyzer)
        • Spreadsheet creator
        • Convert JSON to chart data
        • PDF to image
        • Get weather information
        • HTTP Request
        • Get GEO Location
        • SMTP
        • Loop
      • Built in resources
        • Diaflow Vision
        • Diaflow Vectors
        • Diaflow Drive
        • Diaflow Table
      • Apps
        • Hunter.io
        • Outlook Email
        • Telegram
        • Slack
        • Python
        • YouTube
        • SerpAPI
        • Google Sheet
          • Document-level Operations
          • Sheet-level Operations
          • Data-level Operations
      • Database
        • MySQL
        • Microsoft SQL
        • PostgreSQL
        • Snowflake
      • Private AI/LLM Models
        • OpenAI
          • GPT Variants
          • GPT Vision
          • DALL-E Variants
          • TTS Variants
          • Whisper
        • Anthropic
        • Llama
        • Google Gemini
        • Cohere
        • MistralAI
      • Public AI/LLM Models
        • OpenAI Cloud
        • Perplexity Cloud
        • Deepseek Cloud
        • Anthropic Cloud
        • Replicate
        • Straico
        • OpenRouter
        • Cohere Cloud
        • Google Gemini Cloud
        • MistralAI Cloud
        • ElevenLabs Cloud
      • AI Tools
  • ✒️PRODUCTIVITY TOOLS
    • Tables
    • Drive
    • Vectors
      • Document
      • Article
      • URLs
  • 🏠Workspace
    • History
    • Teams
    • Billing & Subscription
      • Upgrade/Downgrade a subscription
      • Buy credits
      • Credit Usage
      • Cancel a subscription
    • Settings
      • Personnal
      • Workspace
        • Change workspace
        • Workspace settings
        • Custom Domain
        • Delete workspace
      • Change Language
    • Documentation
    • Integrations
    • API keys
  • 📑Other
    • FAQs
    • Contact Information
Powered by GitBook
On this page
  • Description
  • Component settings
  • Advance configurations
  • How it works
  • Example Flow

Was this helpful?

  1. Flows
  2. Component Reference
  3. Built in tools

Loop

The Loop node allows you to iterate over an array of items, executing a set of actions for each item in the list. This is useful when you want to process multiple records.

Last updated 4 days ago

Was this helpful?

Description

What it does: The Loop node iterates over each item in an array and allows you to perform actions on each item individually. It acts like a "for-each" loop, repeating a specific section of your flow for every element in the list. All nested nodes inside the loop will run once per item.

When to use it? Use the Loop node when you need to apply the same logic or action to multiple items — such as sending emails to a list of users, transforming each object in an array, or posting data for every row in a spreadsheet. It’s essential when your automation involves batch processing or repeated steps based on a list of data.

Component settings

The "Loop" node always includes 2 nodes:

  • Loop Over Items

  • Loop Output

  1. Loop Over Items

Parameter Name
Description

Input

A JSON-formatted string that serves as the list of items to iterate over. Caution: Loop node supports up to 100 runs per session. If the data exceeds 100, it stops at the 100th run

Batch size

Number of items to process in each loop iteration (default is 1).

On Error when running loop

Defines error-handling behavior, choose between: - Skip and record error (default) - Stop workflow

  1. Loop Output

Parameter Name
Description

Data to store

Select the variable or value to store from each loop iteration. The final output will be an array of these results.

Advance configurations

The Loop component has no advanced configurations.

How it works

The Loop structure consists of two primary nodes: Loop Over Items and Loop Output.

  • Loop Over Items is the starting point of the loop. It takes a JSON-formatted string as input, where each element in the array represents an item that will be processed one at a time. This node controls how many times the loop will run based on the number of items in the input.

    • Caution: Loop node supports up to 100 runs per session. If data exceeds 100, it stops at the 100th run

  • Between the Loop Over Items and Loop Output, users can insert any processing nodes needed to handle the repeated logic, such as scraping content from websites, formatting JSON, calling AI models, or sending emails. Note that branching nodes (e.g., Branch ) are not supported within a loop.

  • The Loop Output node acts as the endpoint of the loop. In this node, you define which data from within the loop should be collected and returned after the loop completes. It allows referencing any node placed between Loop Over Items and Loop Output. Once selected, those outputs will be aggregated and shown in the Preview of the Loop Output node.

Example Flow

In the example shown above:

  1. The Trigger node passes a list of article URLs in JSON format.

[ { "url": "https://www.theverge.com/2024/4/23/24078670/apple-may-product-event-ipad-date" }, { "url": "https://www.theverge.com/2024/4/23/24078670/apple-may-product-event-ipad-date" } ]

  1. The Loop Over Items node iterates through each URL.

  2. Inside the loop:

    • The JSON Formatter prepares the data structure.

    • The Web Scraper extracts the content from the given URL.

  3. The Loop Output node is configured to store both the formatted URL and the scraped content.

  4. The final Output node then shows the results of the looped operations in a structured format.

This structure allows you to repeat a defined sequence of operations over a list of inputs and collect the results in a single output for further use.

🌊