Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cloudcruise.com/llms.txt

Use this file to discover all available pages before exploring further.

The Loop node repeats a sequence of nodes for each item in an array or a specified number of times. This is essential for processing lists of data. All loop variables (current item and index) must be accessed through context.runtime (e.g., {{context.runtime.current_order}}). You can iterate over:
  • An array value: Loop through each item in a JSON array stored in variable_over (for example, the runtime value of {{context.inputs.orders}} serialized as JSON)
  • A static number: Loop a fixed number of times by specifying a number directly (e.g., 5)

Parameters

ParameterTypeRequiredDescription
variable_overstringYesJSON string containing the array to iterate over, or a number for fixed iterations
variable_current_itemstringYesVariable name to store the current item (accessible via context.runtime)
variable_current_indexstringYesVariable name to store the current index (accessible via context.runtime)

Examples

Loop Over Input Array

Process each item from an input array:
{
  "id": "abc123",
  "name": "Process each order",
  "action": "LOOP",
  "parameters": {
    "variable_over": "{{context.inputs.orders}}",
    "variable_current_item": "current_order",
    "variable_current_index": "order_index"
  }
}
Then access the current item in subsequent nodes:
{
  "id": "def456",
  "name": "Navigate to order",
  "action": "NAVIGATE",
  "parameters": {
    "url": "https://app.example.com/orders/{{context.runtime.current_order.id}}"
  }
}

Loop Body Return

The loop node uses loop_not_done for the first node in the body and loop_done for the exit path. The last node in the loop body should connect back to the loop node with to so the loop can advance to the next item:
{
  "edges": {
    "loop-node-id": {
      "loop_not_done": "first-loop-body-node-id",
      "loop_done": "after-loop-node-id"
    },
    "last-loop-body-node-id": {
      "to": "loop-node-id"
    }
  }
}

Notes

  • The loop automatically increments the index and updates the current item on each iteration
  • variable_over is parsed as JSON at runtime, so arrays must be valid JSON strings
  • Arrays extracted during the loop are appended by default; use overwriteArrayKeys in Extract Datamodel to replace
  • You can access the current index (0-based) using the variable_current_index variable
  • Loops can be nested by using different variable names for each level