> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/combobox/filter-data-tables-with-multi-select-comboboxes.md).

# Filter Data Tables with Multi-Select Comboboxes

Let agents pick several case priorities in a multi-select Combobox and see a Data Table on the same screen list only the matching open cases.

A support agent triaging the queue wants to see only the open cases marked High or Medium. You place a multi-select Combobox above an Avonni Data Table on the same screen. Each time the agent adds or removes a priority, the Data Table runs its query again and lists the matching cases.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FNWWNRVzSpA4WYeGlWj4L%2Fcombobox-filter-data-tables-with-multi-select-comboboxes-result.png?alt=media" alt="Priority combobox with Medium and High selected above a data table listing seven open High and Medium cases"><figcaption><p>Picking Medium and High leaves only the open cases with those priorities.</p></figcaption></figure>

## Before you start

* Avonni Flow Screen Components is installed. See [Installation and Licenses Management](https://docs.avonnicomponents.com/flow/getting-started/installation-and-licenses-management.md).
* You know the basics of the [Combobox](https://docs.avonnicomponents.com/flow/flow-components/combobox.md) and the [Data Table](https://docs.avonnicomponents.com/flow/flow-components/data-table.md).
* The field you filter on belongs to the object the Data Table queries. In this example: `Priority` on `Case`.

## How the filter works

The Data Table accepts its filter as text: the condition part of a query, such as `Priority IN ('High','Medium')`. A Text formula builds that condition from the Combobox's **Value Comma Separated** output, which already holds the selection as a quoted, comma separated list ready for `IN`.

The Combobox has several value outputs. [Use a Combobox Selection in a Query or Flow](https://docs.avonnicomponents.com/flow/tutorials/components/combobox/use-a-combobox-selection-in-a-query-or-flow.md) explains each one and when to use it.

## Steps

{% stepper %}
{% step %}

### Add the multi-select Combobox

1. Create a Screen Flow, add a Screen element, and drag **Avonni Combobox** to the top of the screen.
2. Set its API Name to `PriorityFilter`. The formula in step 3 refers to it by this name.
3. Click **Open Component Builder**. In the **Properties** tab, set **Label** to `Priority` and turn on **Is Multi Select**.
4. Set **Data Source** to **Picklist** and **Picklist Field** to the Case **Priority** field.
5. Optional: set **Placeholder** to `All priorities`.

The Picklist data source stores each option's API value, which is what the query compares. With the standard Case priorities, the label and the API value are the same.
{% endstep %}

{% step %}

### Add the Data Table

1. Drag **Avonni Data Table** below the Combobox.
2. Open the Component Builder, set **Data Source** to **Query**, and pick the **Case** object.
3. Add the columns the agent needs: Case Number, Subject, Priority, Status.

Leave the filter empty for now. Step 4 maps it.
{% endstep %}

{% step %}

### Create the filter formula

In Flow Builder, create a new resource: **Resource Type** Formula, **API Name** `CaseFilter`, **Data Type** Text. Paste this formula:

```
IF(
  ISBLANK({!PriorityFilter.valueCommaSeparated}),
  "Status != 'Closed'",
  "Status != 'Closed' AND Priority IN (" & {!PriorityFilter.valueCommaSeparated} & ")"
)
```

When the agent picks High and Medium, the formula returns `Status != 'Closed' AND Priority IN ('Medium','High')`.

The first branch handles the empty selection. Before the agent picks anything, and after they clear every pill, **Value Comma Separated** is empty and `Priority IN ()` would not be a valid filter. Here the empty case lists every open case. To list nothing until a priority is picked, return `"Id = null"` instead.

{% hint style="warning" %}
Use **Value Comma Separated**, not **Value Collection**. Value Collection is a text collection: a formula cannot join it into the text the filter needs.
{% endhint %}
{% endstep %}

{% step %}

### Map the formula to the Data Table filter

1. Select the Data Table and open the Component Builder.
2. In the **Query** data source, find **Filters**.
3. Open the value type menu next to **Filters** and choose **Mapped**.
4. Search for `CaseFilter` and select it. The panel then shows its label, **Case Filter**.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2F027tpHggBp8PiOLqCXce%2Fcombobox-filter-data-tables-with-multi-select-comboboxes-datatable-filters.png?alt=media" alt="Data Table query on Case with the Filters field mapped to the Case Filter formula" width="320"><figcaption><p>The Filters field mapped to the CaseFilter formula.</p></figcaption></figure>

The Data Table runs its query again each time the formula's result changes, so every pick in the Combobox refreshes the list.
{% endstep %}

{% step %}

### Save and test

Save the flow and click **Debug** or **Run**.

* On load, the table lists every open case.
* Pick **High**: only open High cases remain.
* Open the dropdown again (it closes after each pick) and add **Medium**: the open Medium cases join them.
* Clear the Combobox: the table lists every open case again.
  {% endstep %}
  {% endstepper %}

## Troubleshooting

<details>

<summary>The table shows an error or no rows after a pick</summary>

Check the formula first. The field API name on the left of `IN` must exist on the queried object, and the formula must use straight quotes. To read the exact condition the Data Table receives, add a Display Text on the screen that shows `{!CaseFilter}`. [How to Create a Combobox-Filtered Data Table](https://docs.avonnicomponents.com/flow/tutorials/reactive-query-tutorials/how-to-create-a-combobox-filtered-data-table.md) walks through that check in its Troubleshooting section.

</details>

<details>

<summary>A preselected priority does not filter the table</summary>

When the Combobox opens with a value already selected (its **Value** mapped to a variable, for example), **Value Comma Separated** stays empty until the agent changes the selection. The table shows the formula's empty branch until then. If you preselect a default, write that default as the empty branch.

</details>

<details>

<summary>A value with an apostrophe breaks a formula I wrote by hand</summary>

**Value Comma Separated** escapes apostrophes for you (`'O\'Brien'`). Use it as is rather than adding your own quotes around **Value**.

</details>

## Related tutorials

* [Use a Combobox Selection in a Query or Flow](https://docs.avonnicomponents.com/flow/tutorials/components/combobox/use-a-combobox-selection-in-a-query-or-flow.md): every value output, and how to pass the selection to Get Records, a flow dialog, or a record update.
* [How to Create a Combobox-Filtered Data Table](https://docs.avonnicomponents.com/flow/tutorials/reactive-query-tutorials/how-to-create-a-combobox-filtered-data-table.md): two single-select comboboxes combined in one filter, and filtering on a selected record's Id.
* [Keep Combobox Selections When Users Go Back](https://docs.avonnicomponents.com/flow/tutorials/components/combobox/keep-combobox-selections-when-users-go-back.md): keep the agent's picks when they return to the screen.
* [Build Combobox Options](https://docs.avonnicomponents.com/flow/tutorials/components/combobox/build-combobox-options.md): choose between the Picklist, Query, Variable and Manual data sources.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/combobox/filter-data-tables-with-multi-select-comboboxes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
