# Data Record at Index

{% 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: [*object*](https://docs.zingy.ai/app-editor/page-flow/references/value-types)
{% endhint %}

**`Data Record at Index`** is an [output block](https://docs.zingy.ai/app-editor/block-anatomy#output-block) that provides an object representing the [record](https://docs.zingy.ai/data/database-tables#table-records) at a specified index, after a successful read operation by the [Data Read](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-read), [Data Read Next Page](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-read-next) and [Data Read Previous Page](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-read-previous) blocks.

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

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2F8l97yDNVl8ig2b59XxtK%2Fimage.png?alt=media&#x26;token=4d893e55-b9b7-4a03-8ec5-9bfb012b9259" alt="" width="267"><figcaption><p>Data Record at Index block</p></figcaption></figure></div>

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

* *Table:* [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts a [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) value representing the name of the [Database Table](https://docs.zingy.ai/app-editor/data/database-tables) .
* *Dataset Name:* [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts a [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) value representing the name of the dataset on which a database read was conducted using the Data Read, Data Read Next Page and Data Read Previous Page blocks.
* *Index*: [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts a [*numeric*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) integer values representing the index for which you want the data. The valid values are for the index are from *0* to *Number\_of\_records\_Read - 1.* More on this topic below.

***

## Index&#x20;

The index used to retrieve the data uses [zero-based numbering](https://en.wikipedia.org/wiki/Zero-based_numbering). Hence the valid values start at *0* and end at *1 less than* the total count.

e.g. If the number of records read was *10*, then the valid values are from *0* through *9*.

***

## 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 at Index`** 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%2FXQZhtwmx35JHTJrZtvZY%2Fimage.png?alt=media&#x26;token=c08f8279-0091-4423-8554-4dcd853194ed" alt=""><figcaption><p>Example of <strong><code>Data Record at Index</code></strong> block</p></figcaption></figure>

* To begin, the output of the [Data Record Count](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-count) block is assigned to the variable ***`a`***. Note that the *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables) along with the dataset name of *ds1* are used for the [Value Parameters](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) .
* The **`If`** block to confirm that the value of the variable *a* (number of records read) was at-least ***`1`*** .
* The output of our **`Data Record at Index`** block is assigned to the variable ***`b`*** .  Again note that the *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables) along with the dataset name of *ds1* and *Index* set to the value *0*, are used for the [Value Parameters](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) .
* The [Show Information Popup](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/show-information-popup) block is used to display the values of the *FirstName* and *LastName* properties of variable ***`b`*** .

The result for the above example is shown in the image below.

<figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FQUxOkvG0WgX5qAwzPQPE%2Fimage.png?alt=media&#x26;token=1a690f73-f7c6-44cc-84f2-2c6a0d218767" alt=""><figcaption><p>Result of the example for the Data Record at Index block</p></figcaption></figure>
