Cascade Parameters with Applied Filtering on Report Level
To create cascading report parameters with applied filtering on report level follow the steps below:
-
Using the DataSource Wizard, bind the report to SqlDataSource with query:
SQLSELECT Production.Product.ProductNumber, Production.Product.Name AS ProductName, Production.Product.ProductSubcategoryID, Production.ProductSubcategory.Name AS SubcategoryName FROM Production.Product INNER JOIN Production.ProductSubcategory ON Production.Product.ProductSubcategoryID = Production.ProductSubcategory.ProductSubcategoryID -
Click the ellipses on the Report.ReportParameters property. This invokes the ReportParameter Collection editor.
-
Add new Report Parameter.
-
Name it ProductCategoryID.
-
Set the Type of the parameter to Integer.
-
Expand the AvailableValues.
-
Set the DataSource using the Data Source Wizard to SqlDataSource with query:
SQLSELECT ProductCategoryID, Name AS CategoryName FROM Production.ProductCategory -
It is not compulsory to set the DataMember property when the data source contains only one table.
-
Set the DisplayMember to = Fields.CategoryName column.
-
Set the ValueMember to = Fields.ProductCategoryID.
-
Set the Text to Product Category.
-
Set the Visible property to True if needed.
-
Add new Report Parameter.
-
Name it ProductSubcategoryID.
-
Set the Type of the parameter to Integer.
-
Expand the AvailableValues.
-
Set the DataSource using the Data Source Wizard to SqlDataSource with query:
SQLSELECT ProductCategoryID, ProductSubcategoryID, Name AS SubcategoryName FROM Production.ProductSubcategory -
It is not compulsory to set the DataMember property when the data source contains only one table.
-
Set the DisplayMember to = Fields.SubcategoryName column.
-
Set the ValueMember to = Fields.ProductSubcategoryID.
-
Click on the ellipsis on the Filters property.
-
Add new filter.
-
As Expression choose =Fields.ProductCategoryID.
-
As Operator choose equals(=).
-
As Value choose =Parameters.ProductCategoryID.Value.
-
Click OK.
-
Set the Multivalue to false (or to true if you want to be able to select more than one subcategory at a time).
-
Set the Text to Product Subcategory.
-
Set the Visible property to True if needed.
-
Close the ReportParameter Collection Editor.
-
Click on the ellipsis on the Filters property of the report to open the Edit Filters dialog.
-
Add new filter.
-
As Expression choose =Fields.ProductSubcategoryID.
-
As Operator choose equals(=) (or to IN operator if you have set ProductSubcategoryID parameter as multivalue parameter).
-
As Value choose =Parameters.ProductSubcategoryID.Value.
-
Click OK.
-
Preview the report. Use the Product Category and Product Subcategory parameters to filter the list of products shown in the report.