Getting Started with Seal Report: Applying Dependant Filters
Source: Dev.to
Introduction
This is the fourth report in the series. So far we’ve used different types of restrictions that were independent of each other. Real‑world filtering scenarios often require dependent restrictions, where one selection affects the available values of another.
Within the AdventureWorks2025 open‑source database, a classic example of such dependency is CountryRegion → StateProvince. Applying this filter allows us to narrow down employees based on the province associated with one of their recorded addresses, while ensuring that only provinces belonging to the selected country are available for selection.
In the previous post we examined static and dynamic select lists as data‑table restrictions: Getting Started with Seal Report: Static and Dynamic Select Lists.
Prerequisites
- Import the following tables from the AdventureWorks2025 database:
Person.CountryRegion,Person.StateProvince,Person.Address,Person.BusinessEntityAddress,Person.BusinessEntity. - If the Auto create joins option was enabled during import, the records in the Joins section should resemble the automatically generated relationships.
Creating the CountryRegion Enumeration
Add a dynamic enumeration using the following SQL statement:
SELECT
CountryRegionCode AS [KEY],
Name AS [VALUE]
FROM Person.CountryRegion
ORDER BY Name;Configure the enumeration to load its content dynamically from the SQL statement and refresh it before report execution. Name this enumeration CountryRegion; it will be referenced later when configuring the dependent select list.
Adding the CountryRegion Restriction
- Open Models → Model.
- Drag the
CountryRegionCodeproperty from thePerson.CountryRegiondata table into the Restrictions section. - Link the newly created restriction to the CountryRegion enumeration by selecting it as the custom enumerated list in the Advanced configuration panel.
- Enable Prompt at execution so the restriction appears when the report runs.
Configuring the Dependent StateProvince Enumeration
Base Enumeration
Create the base enumeration with this SQL statement (loads all provinces):
SELECT
StateProvinceID AS [KEY],
Name AS [VALUE]
FROM Person.StateProvince
ORDER BY Name;Dependency Definition
Define the dependency inside Dynamic display → SQL Select Statement for prompted restriction:
SELECT
StateProvinceID AS [KEY],
Name AS [VALUE]
FROM Person.StateProvince
WHERE CountryRegionCode IN ({EnumValues_CountryRegion})
ORDER BY Name;The {EnumValues_CountryRegion} placeholder references the selected values of the CountryRegion restriction, ensuring that only provinces belonging to the chosen country are displayed.
Adding the StateProvince Restriction
Add the StateProvinceID property to the Restrictions section in the same way as the previous restriction. No additional model‑level configuration is required.
Testing the Dependent Filters
- Initially, the StateProvince filter is empty because no country has been selected.
- After selecting a country (e.g., United Kingdom), the dependent filter refreshes automatically and shows only the provinces belonging to that country.
Optional Exercise
- Make the StateProvince filter required.
- Configure a display message indicating that a country or region must be selected first.
Next Steps
All examples so far have used data tables as the underlying source. Real‑life reporting often relies on stored procedures and user‑defined functions. In the next post we’ll explore how the same filtering techniques can be applied when working with those sources.