Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Getting Started
 [Expand]Fundamental Concepts
 [Collapse]Concepts
  [Expand]Report Types
  [Expand]Report Controls
  [Expand]Platform-Specific Reporting
  [Collapse]Creating Reports
   [Expand]Providing Data to Reports
   [Expand]Providing Data To Report Controls
   [Collapse]Shaping Data
     Grouping Data
     Sorting Data
     Filtering Data
     Calculating Summaries
     Formatting Data
   [Expand]Using Report Parameters
   [Expand]Appearance Customization
   [Expand]Navigation and Interaction
   [Expand]Scripting
  [Expand]Storing Reports
  [Expand]Publishing Reports
  [Expand]End-User Reporting
  [Expand]Application Appearance
  [Expand]Migration to XtraReports
 [Expand]Design-Time Features
 [Expand]Examples
  End-User Capabilities
 [Expand]Localization
 [Expand]Redistribution and Deployment
 [Expand]API Reference
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
[Expand]End-User Documentation

Filtering Data

  • Limit the Number of Records to be Displayed
    Options described in this section will let you emulate the Top N feature in a sorted report or increase Print Preview performance by rendering only a subset of report data.

  • Filter a SQL Data Source
    If you connect to a large remote data source and you are sure that certain records will not be required, it's best to filter them out using your data connection query.

  • Filter Data Using Report's Settings
    If you want to have the flexibility of loading the entire dataset and filtering it on the client, use the report's settings as described in this section.

  • Conditional Element Visibility
    Use this technique to hide data parts from a detail band when the corresponding data records meet the specified criteria.

Expanded Limit the Number of Records to be Displayed

When working with large data sources, you can reduce the report generation time for Print Preview loading at design time by using the ReportPrintOptions.DetailCountAtDesignTime property of a report. This property specifies how many times the Detail band should be printed at design time in Visual Studio (similar to the TOP clause in SQL).

Related options you might find useful:

Property Description

ReportPrintOptions.DetailCount

Enables you to limit the number of records shown in a report at runtime.

ReportPrintOptions.DetailCountOnEmptyDataSource

Specifies how many times the Detail band should be printed when no data source is defined for the report.

This option can be used to create static reports.

ReportPrintOptions.PrintOnEmptyDataSource

Specifies whether or not a report should be printed if its data source is empty.

Expanded Filter a SQL Data Source

When a report is bound to a SqlDataSource, you can filter data before it has been supplied to a report. To filter query data, first start a query editor:

  • Switch to the Report Explorer or Field List.

  • Right-click the data source item and select Manage Queries.

  • In the Manage Queries window, click the ellipsis button corresponding to the required query.

In the invoked Query Editor, click the Run Query Builder... button and use the Query Builder to specify filter criteria.

The filter string can reference query parameters that can be linked to report parameters.

For detailed instructions on using query parameters, see How to: Filter Data at the Data Source Level.

Expanded Filter Data Using Report's Settings

To filter data in a report, use the XtraReportBase.FilterString property. To quickly access this property, click the report's smart tag.

In a master-detail report, you can filter detail report data individually.

In the invoked Filter String Editor, specify filter criteria that may reference report parameters and calculated fields.

To learn more about filter criteria syntax, see Creating Criteria.

Expanded Conditional Element Visibility

To change the visibility of specific controls in a report based on one or more logical conditions, use formatting rules.

Consider the following example where the State field is displayed only if the Country value is "USA".

To achieve this, click the report's smart tag and locate the XtraReport.FormattingRuleSheet property.

In the Formatting Rule Sheet Editor, click the plus button to create a new FormattingRule.

Set its Formatting.Visible property to False and specify its FormattingRule.Condition.

To apply the created rule to a control, use its XRControl.FormattingRules property.

To prevent blank areas in place of hidden controls, put these controls into the Panel and set its XRControl.CanShrink property to true.

Expanded See Also

How would you rate this topic?​​​​​​​