# Data Record ID

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

Available in: Page Flow and Cloud Flow

Toolbox Category: Data

Block Type: [Output](https://docs.zingy.ai/app-editor/block-anatomy#output-block)

Output Type: [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types)
{% endhint %}

**`Data Record ID`** is an [output block](https://docs.zingy.ai/app-editor/block-anatomy#output-block) that provides the unique [record identifier](https://docs.zingy.ai/data/database-tables#id-field) for a record. The output is of type [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) and is compatible with [Value Parameters](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) of type [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) or of type [*any*](https://docs.zingy.ai/app-editor/page-flow/references/value-types).

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FTogckSe7fUgywR1LbCIf%2Fimage.png?alt=media&#x26;token=5660466f-a479-45c2-8f2d-95ffe9f7301f" alt="" width="330"><figcaption><p>Data Record ID block</p></figcaption></figure></div>

The block consists of a [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that specifies an object representing a [database record](https://docs.zingy.ai/data/database-tables#table-records) (for which you want the [record identifier](https://docs.zingy.ai/data/database-tables#id-field)). The [Data Record Info](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-info) block is pre-attached by default.

***

## Usage Example

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

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

<figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2Fbufc9cMVy6Camob8sQ9A%2Fimage.png?alt=media&#x26;token=9c68e899-7f9d-49d9-8697-2deafe285c2d" alt=""><figcaption><p>Example of Data Record ID block</p></figcaption></figure>

Here is a summary of the above example:

* The [Data Record Loop](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-loop) block is used with the *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables) and the dataset name of *ds1* are as [Value Parameters](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) .
* For each iteration inside the *Tasks* [Flow Parameter](https://docs.zingy.ai/app-editor/block-anatomy#flow-parameters), we use the [Write Log Message](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/write-log-message) block to log the current iteration index combined with the [record identifier](https://docs.zingy.ai/data/database-tables#id-field) of each record.
* The [Data Record Loop Index](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-loop-index) block is used to get the current iteration index.
* To access information about the [record identifier](https://docs.zingy.ai/data/database-tables#id-field), we use the **`Data Record ID`** 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/30/2023 08:45:03.513] Index:  0 ID: 64e7833db5ed96040cc512bd
[LOG(info) 08/30/2023 08:45:03.514] Index:  1 ID: 64e78542b5ed96040cc51328
[LOG(info) 08/30/2023 08:45:03.515] Index:  2 ID: 64e78594b5ed96040cc5133c
[LOG(info) 08/30/2023 08:45:03.515] Index:  3 ID: 64e785c8b5ed96040cc5134b
```
