What is Parent-Child Filters?
Parent-child filters limit the suggested values viewers can choose from in a filter (child) based on the selected values in other filters (parent)
For example, a dashboard has filters Country and City. If viewers choose Country = United States, they will only see the options of Chicago and New York in filter City
How to set up Parent-Child filters
To set up the Parent-Child filters, you need at least 2 filters: one as the Parent and one as the Child. The Parent filter limits the suggested values of the Child filter.
In Holistics, we will start at the Parent filter and link it to the Child filter. In this example, the Parent filter is Country and the Child filter is City.
- Edit the Country filter, then go to the Child Filters section. Toggle on to start linking.
- Find the filter you want to limit the suggested values (in this case: City), and toggle it on.
- Some filters in the Child Filters section cannot be toggled on because the filter type is not Field. For more information, please visit the Parent-child filter relationship section.
- One Parent filter can have many Child filters and vice versa.
How does the Parent-Child filter work?
When viewers open the field suggestion of the Child filter, Holistics will run a query with the condition of the Child filter's settings and the selected values of the Parent filter.
Then it will return the results in a drop-down for users to choose from.
Let's take the Country - City filter example.
When viewers select Country filter value = United States, nothing will happen, yet.
When viewers click on the City filter to open the drop-down, Holistics will find all the cities in the database that belong to the United States, then return the results as suggested values in the City filter drop-down.
Whether a Parent filter can limit the Child filter's values depends on 3 factors:
- The filter type of the Child filter
- The relationship of the models that contain the fields from which the Parent filter and Child filter are created
- The dataset that contains the models above
|Case no.||Parent filter type||Child filter type||Model relationship||Same dataset?||Result|
|3||Field||Field||No||Yes||Linkable but Parent's values do not limit Child's values|
|4||Field||Field||No||No||Linkable but Parent's values do not limit Child's values|
|7||Non-field||Field||No||Linkable but Parent's values do not limit Child's values|
When you link a Parent to Child filter, it's a one-way direction. This means when you select a value in Parent, it will limit the Child filter's suggested values. If you select a value in Child, it will not limit the Parent filter's suggested values.
If you want to make it a two-way direction, you can link the Child to the Parent following the same process in How to set up Parent-Child filter. Please be mindful that these might lead to unwanted results for viewers.