Author: Ian Britz
It's often the case that certain combinations of filter selections are not valid. For example, a company may sell a particular brand in one country, but not another. As a result, you would want to define a relationship between countries and brands, so that such a combination could never be reached. These types of valid relationships can be defined with Linked Models.
However, as old filter selections aren't automatically cleared out, it's still possible for users to reach an invalid combination. In this article, we'll examine the Clear Filters functionality, which can be used to prevent these types of combinations from being possible.
To demonstrate a situation where this feature is useful, let's return to the example situation outlined above. This particular company has a number of Entities, Brands, and Products. Certain Products are only valid within a particular set of Brands, and certain Brands are only valid within a particular set of Entities, outlined in the image below:
In this application, Linked Models have already been used to define these relationships--so that when Canada is selected for Entity, Zofia is not a selectable option as that Brand is not valid in Canada.
However, if we change the filter selection from Canada to Australia, Aviva remains the selected Brand--even though it's not a valid brand in Australia.
Let's configure our filters to prevent this combination.
Configure Clear Filters
Step 1. Let's first make some changes to the default filter settings. Navigate to the relevant Form and put it in edit mode. In the FILTER tab, select the gear icon next to the Brand Filter to change its default member.
Select Custom Member and then enter the text to be displayed when the filter has no selection, such as "Please Select...". Check both the Use when empty and Skip refresh options as well. This tells the filter to use the text we entered when the filter selection is empty and to not refresh the Form until a valid member is selected.
Note: Repeat Step 1 for the Product Filter.
Step 2. Save the Form and navigate to the Dashboard Editor.
Step 3. From the Dashboard Editor, select the Filter option from the ribbon at the top of the page.
Tip: For more information on the Filter option, refer to this article.
In the CLEAR FILTERS tab, select the green plus icon to create a new definition that will define the relationship between filter hierarchies, and then give it a name.
Step 4. In the DEFINITION tab on the right, select the hierarchy filters in the order that would make a valid selection. In our example, this would be Entity > Brand > Product.
Step 5. In the SCOPE tab, select all the Dashboard Forms where this relationship should apply. Click OK to finish.
Navigate to the PREVIEW tab in the Dashboard Editor. Now when we change the filter selection for one of the hierarchy filters, all filters that are ordered lower in the hierarchy filter relationship will have their selections erased. With this configuration, invalid filter combinations are not possible.