Filter Data at the Report Level
- 2 minutes to read
This tutorial illustrates how to filter data at the report level, as opposed to the data source level. This approach is useful when dealing with relatively small data sources, when data load times are acceptable.
Create a Reporting Application
To get started with this tutorial, open an existing reporting application or create a new one from scratch. To learn how to create a reporting application on the platform of your choice, see Adding a Report to Your .NET Application.
The report created in this tutorial will be platform-agnostic, which means that you can use it later in applications created on any supported platform. See Store and Distribute Reports to learn more about storing and reusing reports.
Filter Data in the Report
- To create a table report in this tutorial, start with a report that is bound to the "Products" table of the sample Northwind database (the nwind.mdb file included in the XtraReports installation). To learn more about binding a report to a data source, see Provide Data to Reports.
To apply filtering to the report, click its smart tag, and click the ellipsis button for the XtraReportBase.FilterString property in the invoked actions list.
In the FilterString Editor that is invoked, construct an expression in which the UnitPrice data field is compared with the required value.
Using this editor, you can also embed report parameters into the expression (e.g., to request their values each time a report is generated).
Preview and Publish the Report
Your report is now ready to be generated. In Visual Studio, you can view the report by switching to the Preview tab.