# Data Record Loop

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

Available in: Page Flow and Cloud Flow

Toolbox Category: Data

Block Type: [Regular](/app-editor/page-flow/block-anatomy.md#regular-block)
{% endhint %}

**`Data Record Loop`** is a [regular block](/app-editor/page-flow/block-anatomy.md#regular-block) that allows you to iterate over all the [records](/app-editor/data/database-tables.md#table-records) retrieved, after a successful read operation, by the [Data Read](/app-editor/page-flow/toolbox-blocks/data-read.md), [Data Read Next Page](/app-editor/page-flow/toolbox-blocks/data-read-next.md) and [Data Read Previous Page](/app-editor/page-flow/toolbox-blocks/data-read-previous.md) blocks.

{% hint style="warning" %}
NOTE: This block will provide valid values only after the [Data Read](/app-editor/page-flow/toolbox-blocks/data-read.md), [Data Read Next Page](/app-editor/page-flow/toolbox-blocks/data-read-next.md) and [Data Read Previous Page](/app-editor/page-flow/toolbox-blocks/data-read-previous.md) blocks complete their execution. The [Data Status](/app-editor/page-flow/toolbox-blocks/data-status.md) block can be used to track the completion.
{% endhint %}

<div align="left"><figure><img src="/files/IHFdW2uyLxHTfMmeKcPm" alt="" width="448"><figcaption><p>Data Record Loop block</p></figcaption></figure></div>

The block consists of the following (from top to bottom):

* *Table:* [Value Parameter](/app-editor/page-flow/block-anatomy.md#value-parameters) that accepts a [*text*](/app-editor/page-flow/references/value-types.md) value representing the name of the [Database Table](/app-editor/data/database-tables.md) .
* *Dataset Name:* [Value Parameter](/app-editor/page-flow/block-anatomy.md#value-parameters) that accepts a [*text*](/app-editor/page-flow/references/value-types.md) value representing the name of the dataset on which a database read was conducted using the [Data Read](/app-editor/page-flow/toolbox-blocks/data-read.md), [Data Read Next Page](/app-editor/page-flow/toolbox-blocks/data-read-next.md) and [Data Read Previous Page](/app-editor/page-flow/toolbox-blocks/data-read-previous.md) blocks.
* *Tasks*: a [Flow Parameter](/app-editor/page-flow/block-anatomy.md#flow-parameters) where you connect blocks that specify what you want done with each record. Use the [Data Record Info](/app-editor/page-flow/toolbox-blocks/data-record-info.md) and [Data Record Loop Index](/app-editor/page-flow/toolbox-blocks/data-record-loop-index.md) blocks here to access the record information for each iteration.

***

## 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`** 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/xAhz9VSxLGPuVUKIGp30" alt=""><figcaption><p>Example of Data Record Loop</p></figcaption></figure>

Here is a summary of the above example:

* The **`Data Record Loop`** 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 customer's full name by accessing the *FirstName* and *LastName* fields of each record and combining them.
* To access information about the record, we use the [Data Record Info](/app-editor/page-flow/toolbox-blocks/data-record-info.md) block.
* For the *FirstName* and *LastName* fields we use the [Get Object Property](/app-editor/page-flow/toolbox-blocks/get-object-property.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:

```log
[LOG(info) 08/29/2023 10:39:29.413] John Smith
[LOG(info) 08/29/2023 10:39:29.415] Jane Smith
[LOG(info) 08/29/2023 10:39:29.415] Max Mustermann
[LOG(info) 08/29/2023 10:39:29.415] Joe Bloggs
```


---

# 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.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.
