# QUERY

**When retrieving list data, SOQL can be written in advance to filter and sort the data**. Filters correspond to the WHERE clause in SOQL, while sorting is done using the ORDER BY clause. Although users can manually write the query, the Query Wizard allows for easy application of filters without requiring knowledge of SOQL.

{% hint style="info" %}
The **WHERE clause** specifies the conditions for the records that will appear in the data table. Users can either manually input the WHERE clause or use the **Query Wizard** to configure it.
{% endhint %}

{% hint style="info" %}
The **ORDER BY clause** determines how the records in the data table will be sorted based on specific fields. Users can manually input the ORDER BY clause or use the **Field API Name Finder** to set it up.
{% endhint %}

***

### :small\_orange\_diamond: Steps to Configure Query

1. In the **WHERE clause**, click the **Query Wizard** button in the bottom-right corner.\\

   <div><figure><img src="/files/mh5xGxPHuttgHPi9nm3H" alt="" width="308"><figcaption><p>Datatable Setup</p></figcaption></figure> <figure><img src="/files/I4YmBM0fQxvKUzA0C3nY" alt=""><figcaption><p>Query Wizard</p></figcaption></figure></div>
2. Configure the field and value for the condition, then click the Apply button.
3. In the **ORDER BY clause**, click the **Field API Name Finder** button in the bottom-right corner.\\

   <figure><img src="/files/Jnyl0ELxuXY0iELHVll9" alt=""><figcaption><p>Field API Name Screen</p></figcaption></figure>
4. Select the field you want to sort by.
5. In the **Result** field, add **ASC**(ascending) or **DESC**(descending) after the field’s API name and click the **Save** button to finalize your query.


---

# 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://help.smallbuilder.com/smallbuilder-lists/builder-setup-steps/datatable-setup/query.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.
