Skip to content

🎯 MF used in sequencer ​

This section presents the merge fields that are specific to the Sequencer.
They are designed to be used only within actors like Loop and API Call, and their behavior depends on the actor configuration and triggers.

πŸ“˜ loop_item Merge Field Documentation ​

loop_item is a Sequencer-specific merge field available inside any actor that is executed downstream of a Loop actor. This includes actors connected directly or indirectly to the Loop actor.

During execution, the Loop actor iterates over a collection and exposes the current element as loop_item. Each downstream actor invocation receives the value corresponding to the current iteration.


πŸ“‘ Table of Contents ​


πŸ” Overview ​

The merge field loop_item represents the current item processed by a Loop actor.

It supports nested properties:

jinja
    {{ loop_item.name }}
    {{ loop_item.mime_type }}
    {{ loop_item.size }}

Depending on the Loop's source, may represent:

  • an array item (Array source, API Call source, Variable source)
  • a document representation (Document Picker source)

Example usage inside an API Call actor:

jinja
    url="https://example.test/{{ loop_item.size }}"
    headers="?file={{ loop_item.name }}"
    params='{"type": "{{ loop_item.mime_type }}"}'

🎯 Availability ​

loop_item can be used in any actor executed downstream of a Loop actor.

  • directly connected to a Loop actor triggered by "Loop item processed"
  • indirectly connected through other actors

The merge field is available within the execution context of a single loop iteration, meaning each downstream actor receives the value of loop_item corresponding to the currently processed element.


βš™οΈ Behavior ​

1. Correct Rendering During API Call Test ​

When testing an API Call actor connected via "Loop item processed":

  • loop_item resolves to the actual current item

  • Nested properties render correctly

  • If the Loop's source is misconfigured (not an array):

    • It attempts to use the first item of the provided data

    • If no usable item exists β†’ empty string


2. Behavior with "Actor completed" Trigger ​

When the API Call actor is connected using "Actor completed":

  • During testing, loop_item β†’ empty string

3. Document Picker as Loop Source ​

Assumptions:

  • Loop actor uses Document Picker
  • API Call actor is connected via "Loop item processed"
  • API Call is configured correctly

Behavior:

Document Picker Input loop_item result


Empty "" (empty string)

Contains document Document representation


4. Exception Handling ​

During API Call testing:

  • If resolving loop_item throws any exception, it is rendered as empty string

5. Multiple Loop Connections ​

If the API Call actor is connected to multiple Loop actors, each potentially supplying a :

  • During testing, the Sequencer always uses the most recently modified Loop actor
  • All other Loop connections are ignored for the purpose of evaluation in testing mode

πŸ‘πŸ‘Ž Good vs Bad Configuration Examples ​

Loop with Array Source ​

πŸ‘ Good ​

json
{
  "files": [
    { "name": "file1.txt", "size": 1200 },
    { "name": "file2.txt", "size": 3400 }
  ]
}

where json.path is files

πŸ‘Ž Bad ​

json
{}

or

json
{
  "files": [
    { "name": "file1.txt", "size": 1200 },
    { "name": "file2.txt", "size": 3400 }
  ]
}

where json.path is not set


Loop with Document Picker ​

πŸ‘ Good ​

jinja
    {{ loop_item.size }} β†’ "312345"
    {{ loop_item.name }} β†’ "invoice.pdf"
    {{ loop_item.mime_type }} β†’ "application/pdf"

OR ​

jinja
    {{ loop_item }} β†’ 
    {
        "name": "invoice.pdf",
        "size": 312345,
        "mime_type": "application/pdf",
    }

Incorrect Triggers ​

πŸ‘ Good ​

  • Loop item processed

πŸ‘Ž Bad ​

  • Actor completed

πŸ“ Summary ​

loop_item is a dynamic merge field tied to the execution context of a Loop actor:

  • Available in any actor executed downstream of a Loop actor
  • Represents the current element processed in a loop iteration
  • Supports nested properties
  • Handles arrays and documents
  • In all error cases β†’ resolves to an empty string
  • When multiple Loops are connected, the last modified Loop is used during testing

πŸ“˜ loop_counter Merge Field Documentation ​

loop_counter is a Sequencer-specific merge field available inside any actor that is executed downstream of a Loop actor. This includes actors connected directly or indirectly to the Loop actor.

During execution, the Loop actor iterates over a collection and exposes the current iteration index as loop_counter.

The value starts from 1 for the first processed element and increases by 1 for each subsequent iteration.

🎯 Availability ​

loop_counter can be used in any actor executed downstream of a Loop actor.

This includes actors that are:

  • directly connected to the Loop actor
  • indirectly connected through other actors
  • triggered during the execution of the Loop iteration

The merge field is available within the execution context of a single loop iteration, meaning each downstream actor receives the loop_counter value corresponding to the current iteration.

βš™οΈ Behavior ​

  • loop_counter represents the index of the current loop iteration.
  • The value increments with every processed element.
  • The first iteration returns 1, the second 2, and so on.
  • The value is recalculated for each loop iteration.