# Choice filters (Casacade)

Choice filters allow you to dynamically filter the options shown in a `select_one` or `select_multiple` question based on the answer to a previous question.

They are useful when you have linked dropdowns, such as showing cities based on the country selected, or filtering job titles based on department.

#### How choice filters work

To use a choice filter, follow these steps:

1. In the `survey` sheet, add a column named `choice_filter`.
2. In the `choices` sheet, add an extra column with the filtering attribute.
3. The `choice_filter` expression in the survey sheet must match the filter value from the selected answer.

The syntax for the filter is:

`filter_column = ${question_name}`

This compares a column in the choices sheet to the value selected in a previous question.

{% hint style="danger" %}
Choice filters will only work on the select\_one if its defined within [group](/projects/import-export/xlsform/survey-sheet/groups.md) that defines a page with the field-list appearance. It will not work within a group that doesnt have a field-list apperance
{% endhint %}

#### Example: Country and city

**survey sheet**

| type                | name    | label            | choice\_filter       |
| ------------------- | ------- | ---------------- | -------------------- |
| select\_one country | country | Select a country |                      |
| select\_one city    | city    | Select a city    | country = ${country} |

**choices sheet**

| list\_name | name   | label         | country |
| ---------- | ------ | ------------- | ------- |
| country    | usa    | United States |         |
| country    | france | France        |         |
| city       | nyc    | New York City | usa     |
| city       | la     | Los Angeles   | usa     |
| city       | paris  | Paris         | france  |
| city       | lyon   | Lyon          | france  |

What happens:

1. The user selects a country in the first question (e.g. France).
2. The second question (Select a city) only shows cities where the `country` column in the choices sheet matches the selected country (`france` in this case).
3. So only "Paris" and "Lyon" will appear in the city dropdown.


---

# 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.ngsurvey.com/projects/import-export/xlsform/survey-sheet/choice-filters-casacade.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.
