# Data Record Loop Index

{% hint style="info" %}
**Block Information**

Available in: Page Flow and Cloud Flow

Toolbox Category: Data

Block Type: [Output](/app-editor/page-flow/block-anatomy.md#output-block)

Output Type: [*numeric*](/app-editor/page-flow/references/value-types.md)
{% endhint %}

**`Data Record Loop Index`** is an [output block](/app-editor/page-flow/block-anatomy.md#output-block) that provides the [zero-based](https://en.wikipedia.org/wiki/Zero-based_numbering) index of the current iteration of the [Data Record Loop](/app-editor/page-flow/toolbox-blocks/data-record-loop.md) block, when used inside the *Tasks* [Flow Parameter](/app-editor/page-flow/block-anatomy.md#flow-parameters). The output is of type [*numeric*](/app-editor/page-flow/references/value-types.md) and is compatible with [Value Parameters](/app-editor/page-flow/block-anatomy.md#value-parameters) of type [*numeric*](/app-editor/page-flow/references/value-types.md) or of type [*any*](/app-editor/page-flow/references/value-types.md).

<div align="left"><figure><img src="/files/1NdoCyrYXrkCwLIAg1FN" alt="" width="221"><figcaption><p>Data Record Loop Index block</p></figcaption></figure></div>

{% hint style="warning" %}
NOTE: This block will provide valid values when used inside the *Tasks* [Flow Parameter](/app-editor/page-flow/block-anatomy.md#flow-parameters) of the [Data Record Loop](/app-editor/page-flow/toolbox-blocks/data-record-loop.md) block.
{% endhint %}

***

## Usage Example

{% hint style="info" %}
**NOTE: Please refer to the prerequisite information shown** [**here**](/app-editor/page-flow/references/prerequisite-for-data-examples.md) **before seeing the example.**&#x20;
{% endhint %}

The image below shows an example of the **`Data Record Loop Index`** block. This example incorporates the *Usage Example* function, as outlined in the [Database Reading Logic for examples section](/app-editor/page-flow/references/prerequisite-for-data-examples.md#database-reading-logic-for-examples) on the prerequisite information page mentioned above.

<figure><img src="/files/h27BDmEoT6zafnAmf2UX" alt=""><figcaption><p>Example of Data Record Loop Index block</p></figcaption></figure>

Here is a summary of the above example:

* The [Data Record Loop](/app-editor/page-flow/toolbox-blocks/data-record-loop.md) block is used with the *Customers* [Database Table](/app-editor/data/database-tables.md) and the dataset name of *ds1* are as [Value Parameters](/app-editor/page-flow/block-anatomy.md#value-parameters) .
* For each iteration inside the *Tasks* [Flow Parameter](/app-editor/page-flow/block-anatomy.md#flow-parameters), we use the [Write Log Message](/app-editor/page-flow/toolbox-blocks/write-log-message.md) block to log the current iteration index combined with the customer's email address by accessing the *EmailAddress* field of each record.
* The **`Data Record Loop Index`** block is used to get the current iteration index.
* To access information about the record, we use the [Data Record Info](/app-editor/page-flow/toolbox-blocks/data-record-info.md) block.

The result for the above example can be seen in the [browser's web console](https://developer.chrome.com/docs/devtools/console/), and a sample is shown below (Note the [zero-based](https://en.wikipedia.org/wiki/Zero-based_numbering) index):

```log
[LOG(info) 08/29/2023 14:40:12.682] Index:  0 Email: john.smith@example.com
[LOG(info) 08/29/2023 14:40:12.683] Index:  1 Email: jane.smith@example.com
[LOG(info) 08/29/2023 14:40:12.684] Index:  2 Email: max.mustermann@example.com
[LOG(info) 08/29/2023 14:40:12.684] Index:  3 Email: joe.bloggs@example.com
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-loop-index.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
