# Data Lookup

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

Available in: Page Flow and Cloud Flow

Toolbox Category: Data - Read

Block Type: [Regular](https://docs.zingy.ai/app-editor/block-anatomy#regular-block)
{% endhint %}

**`Data Lookup`** is a [regular block](https://docs.zingy.ai/app-editor/block-anatomy#regular-block) that triggers the search for a [record](https://docs.zingy.ai/data/database-tables#table-records) from a [database table](https://docs.zingy.ai/app-editor/data/database-tables). The search operation is carried out using criteria that include values for the unique field (or fields) of the table.

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2Fpxx7R2U3QahlifzB4V5K%2Fimage.png?alt=media&#x26;token=fa7f2f8e-7cb3-4e75-bcd4-31e663e13e7e" alt="" width="194"><figcaption><p>Data Lookup 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. This can be any text value and can later be used to track the completion of the read.
* *Criteria*: [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts an [object](https://docs.zingy.ai/app-editor/page-flow/references/value-types) value containing the search criteria. The Object block is pre-attached by default and its properties are automatically populated based on the unique fields of the selected table.

{% hint style="success" %}
**NOTE**:&#x20;

* This block initiates the database search, which will occur in the background. To track the status and to take an action upon completion of the search, use the [Data Status](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-status) block.&#x20;
* To access the record after a successful search, use the [Data Record Info](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-info) block.
  {% endhint %}

***

## 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 Lookup`** block where a search is conducted on the *Customers* database table which we have discussed [here](https://docs.zingy.ai/app-editor/page-flow/references/prerequisite-for-data-examples).&#x20;

<figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2Fon3dgLKUgnR7ZHcUyVvD%2Fimage.png?alt=media&#x26;token=5350ecd1-4af9-46a2-bddb-58b8213403bd" alt=""><figcaption><p>Example of Data Lookup</p></figcaption></figure>

As the *Customers* database table has a single unique field *CustomerID*, the Criteria value parameter is linked to an object with its *CustomerID* property assigned to the desired search value, which is *2* in this scenario.

To track the completion of this search operation, we use the [Data Status](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-status) block. When the search completes successfully, we use the [Data Record Info](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-record-info) block to retrieve the *FirstName* and *LastName* fields and display that using the [Show Information Popup](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/show-information-popup) block.

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%2FcH48evYu9RvVsR6M5ehp%2Fimage.png?alt=media&#x26;token=85c5528c-9a1e-407b-a8ee-5ec2f99a9801" alt=""><figcaption><p>Result for the Data Lookup block example</p></figcaption></figure>
