# The Table View

## Search

To search in Forest, use the search bar at the top of the page **(1)**:

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-c49cad68e3a61b4bb9c0dc55e83cb7a980a64b84%2FCapture%20d%E2%80%99e%CC%81cran%202022-01-26%20a%CC%80%2017.35.18.png?alt=media)

Your search terms are highlighted within the matching results **(2)**.

{% hint style="warning" %}
Only regular fields are searched on. All *reference fields* of `belongsTo` records are ignored, unless you are using an **extended search**.
{% endhint %}

### Extended search

Lets search for "Lowe":

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-6e78cdb36d5c92ce43b4f58160423514f3327ae3%2FCapture%20d%E2%80%99e%CC%81cran%202020-01-17%20a%CC%80%2016.27.33.png?alt=media)

We get no result!

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-16a3f4dadd9222154c7b3bc644e6f8b3fb023c13%2FCapture%20d%E2%80%99e%CC%81cran%202020-01-17%20a%CC%80%2016.28.26.png?alt=media)

The **extended search** lets you search also within *reference fields* of `belongsTo` records.

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-61f844afbf1de5720bab1bfc9ec3827888e171c8%2Fimage.png?alt=media)

{% hint style="info" %}
*Extended search* is **not the default** search because it is **slower**.
{% endhint %}

### Advanced search syntax

{% hint style="info" %}
*Advanced search syntax* is only supported on nodejs agents `@forestadmin/agent` starting from version 1.36.18.
{% endhint %}

Search supports advanced syntax to help you find exactly what you are looking for:

* `-term` will search for records that do not contain `term` ;
* `property:term` will search for records that contain `term` in the `property` field ;
* `relation.childProperty:term` will search for records that contain `term` in the `childProperty` field of the `relation` relation ;
* `term1 OR term2` will search for records that contain `term1` or `term2` ;
* `term1 AND term2` will search for records that contain `term1` and `term2` (equivalent to `term1 term2`);
* `term1 AND (term2 OR term3)` will search for records that contain `term1` and either `term2` or `term3`.
* `property:NULL` will explicitly search for records that contain the technical value `NULL` in the `property` field ;
* `"multiple quoted words"` will search for records that contain the phrase `multiple quoted words` without splitting it into multiple terms ;

All elements of the advanced syntax can be combined, for instance `(property:term OR -term2) AND (property1:NULL OR relation.childProperty:term3)`.

Please note that `NULL`, `OR` and `AND` need to be written in capital letters to be interpreted as operators.

### Focused search on one property

The following syntax allows to search a specific term only on a given property in a database:

* `property:searchedTerm` will search the term "searchedTerm" in the field named `property` ;
* `relation.childProperty:searchedTerm` will search the term "searchedTerm" in the field `childProperty` inside the relation named `relation`.

{% hint style="info" %}
The property name needs to match the technical one in the database. Forest Admin will ignore casing and separator characters such as `-` and `_` when searching for fields. For instance `property_name` will match an technical property named `propertyName`.
{% endhint %}

Focused search can be combined with other syntax, such as `property:>20` to search for a value greater than 20.

### Search on text fields

Searching on text fields is done differently, depending on the different operators supported by your database. We select the right operator in this order of priority:

1. `Contains (case insensitive)`
2. `Contains (case sensitive)`
3. `Equal`

It means that, in a database that supports the first operator, searching the term `Term` will return all records containing the text `term` even if the case does not match. For instance:

* `TERM` will match
* `abcTERMdef` will also match

#### Searching on numbers

Number fields support the following additional syntax:

* `>42` will search for records that contain a number greater than `42` ;
* `>=42` will search for records that contain a number greater than or equal to `42` ;
* `<42` will search for records that contain a number lower than `42` ;
* `<=42` will search for records that contain a number lower than or equal to `42`.

This syntax can be used in combination with property names, for instance `property:>42` will search for records that contain a number greater than `42` in the `property` field.

#### Searching on dates

Date fields support the following additional syntax:

* `2020` will search for records that contain a date in the year `2020` ;
* `2020-01` will search for records that contain a date in `January 2020` ;
* `2020-01-01` will search for records that contain a date on `January 1st 2020` ;

Operators `>`, `>=`, `<`, `<=` can be used in combination with dates, for instance

* `property:>2020-01-01` will search for records that contain a date after `January 1st 2020` in the `property` field ;
* `property:<=2020` will search for records that contain a date in `2020` or before in the `property` field.

Dates will be considered expressed in the timezone configured in Forest Admin.

#### Searching on booleans

Boolean values support the following additional syntax:

* `true` or `1` will search for records that contain `true` ;
* `false` or `0` will search for records that contain `false` ;

True and false values are case insensitive, meaning that `True` and `False` will also work for instance.

## Filters

Searching is just one way to be faster at finding the desired data. Forest Admin also allows you to use filters to sort your data.

### Sort your data

By clicking on a column’s header **(1)**, you will sort the data by descending then ascending order, depending on the type of data in this field. An arrow **(2)** will appear in the header, showing you that this column is sorted.

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-c68e79255303648bbefb131f128c810cefd0feaf%2FCapture%20d%E2%80%99e%CC%81cran%202019-06-28%20a%CC%80%2016.06.09.png?alt=media)

### Add one or several filters

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-99a54b75ade623b6638bce3859732ebbabe37a53%2FCapture%20d%E2%80%99e%CC%81cran%202019-08-12%20a%CC%80%2018.16.32.png?alt=media)

You can filter your list of records by clicking at the very end of the search bar on ‘Filter’ **(1)**. Or you can also click on the filter icon in column headers as a shortcut to pre-fill the property you wish to filter on **(2)**.

If you notice there is no filter **(3)**: either you have [disabled filtering on this field](https://docs.forestadmin.com/user-guide/collections/customize-your-fields#basic-settings), or it is a Smart Field that does not support filters.

Once opened, the filter management dropdown will look like this:

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-0c2e8be7c0912fab93c2ed7afe62ab866c7adbc2%2Fimage.png?alt=media)

{% hint style="info" %}
The list of filtering options available depends on the nature of the selected field.
{% endhint %}

To change the logic between conditions, simply click to toggle between AND and OR.

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-fc459defc06a612176999f62936db37c8d694d78%2FCapture%20d%E2%80%99e%CC%81cran%202019-08-12%20a%CC%80%2018.32.27.png?alt=media)

Click **Apply filters** for them to be taken into account.

Once applied, you can save filters as segments (learn more about [segments](https://docs.forestadmin.com/user-guide/collections/segments#what-is-a-segment)).

{% hint style="warning" %}
**Filtering on related data** is available from version 7.3.0 (4.0.0 for Rails).
{% endhint %}

### Understanding filters

Most filters are quite straight-forward. Some, however, require a little more explanation:

#### Date filters

There are many date filters which should let you filter exactly on the time period of your choice, but it can get a little confusing. We've added a tooltip which tells you what the directly within the dropdown:

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-f8c9aaec8a8b709b3af4294b0f14abb9ed81257e%2Fdocforest.png?alt=media)

{% hint style="success" %}
Just **hover** a date filter to see how it would apply right now.
{% endhint %}

#### "is blank" vs "is present" (Mongodb only)

In NoSQL orms, there is a difference between:

{% code title="Sample A" %}

```
{ color: "red", size: "" }
```

{% endcode %}

and

{% code title="Sample B" %}

```
{ color: "red" }
```

{% endcode %}

Now imagine a third sample:

{% code title="Sample C" %}

```
{ color: "blue", size: "M" }
```

{% endcode %}

Then the following filter conditions will yield the following results:

| Condition(s)                      | Result(s) |
| --------------------------------- | --------- |
| size is blank                     | A and B   |
| size is present                   | A and C   |
| size is present and size is blank | A         |

## Select

The Table View does not only display your data. It also allows you to interact with it:

{% hint style="info" %}
Forest Admin provides basic CRUD actions out of the box. Check out how you can [duplicate and delete from the Table View](https://docs.forestadmin.com/user-guide/collections/actions#native-actions), but also [create](https://docs.forestadmin.com/user-guide/collections/actions/create-a-record) and [update](https://docs.forestadmin.com/user-guide/collections/actions/edit-a-record) from dedicated views.
{% endhint %}

#### Select all records vs Select current page only

On all Table Views, you'll notice a down caret (▾) next to the top-left header checkbox. Clicking on it lets you choose between selecting all records of the collection or selection only records from the current page:

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-9ecbfe44a2a4c120831c42e59d3dbd95bdb32088%2FCapture%20d%E2%80%99e%CC%81cran%202020-03-05%20a%CC%80%2017.47.07%20copie.png?alt=media)

Selecting all records has no consequence, however applying an action to all those records might. That's why we've added a warning when you **select all records (1)**:

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-906e101eb347dd78bb94e9e9c7eb3458c3d172d6%2FCapture%20d%E2%80%99e%CC%81cran%202020-03-05%20a%CC%80%2017.47.19%20copie.png?alt=media)

{% hint style="info" %}
Having selected all records, you can deselect records from this page only: moving to any another page will deselect all records.
{% endhint %}

Otherwise, you can **select records from current page only (2)** which will select only visible records:

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-b547abee057a04e58cd1f7f2f84fc58e4a91bcf4%2FCapture%20d%E2%80%99e%CC%81cran%202020-03-05%20a%CC%80%2017.47.40%20copie.png?alt=media)

## Pagination

Navigating the Forest Admin interface is pretty straightforward, and it won’t come as a surprise that our pagination is equally straightforward.

### Browse several pages

Very large collections can’t be displayed on a single page. Where this is the case, you will be able to check the number of records in the collection at the bottom right side of the Table View **(1)**. At the bottom in the middle, you will be able to browse through the different pages of the collection **(2)**.

![](https://85223878-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOx0Wo3NZjrQrGQthTy6o%2Fuploads%2Fgit-blob-2cd70a90d642cfee983a01e05369307e4a4d7179%2FCapture%20d%E2%80%99e%CC%81cran%202019-06-28%20a%CC%80%2015.53.01.png?alt=media)


---

# 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.forestadmin.com/user-guide/getting-started/master-your-ui/the-table-view.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.
