> For the complete documentation index, see [llms.txt](https://docs.ngsurvey.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ngsurvey.com/projects/import-export/xlsform/survey-sheet/choice-filters-casacade.md).

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