Edit this page

Report Filters

RadPivotGrid allows you to add filter conditions which describe which items from the data source should be included in the report. These filters are called Report Filters. Report filtering occurs before the aggregated information is calculated. This type of filtering is useful when you would like to see a report which concerns only records that share a common property, for example a sales report only for a specified country.

Figure 1: RadPivotGrid Report Filters

pivotgrid-filtering-report-filters 001

The report filters are displayed as descriptor elements in the report filters area. This area is hidden by default and in order to show it, you need to set the following property:

ShowFilterArea Property

this.radPivotGrid1.ShowFilterArea = true;

Me.radPivotGrid1.ShowFilterArea = True

The end-user can add/remove report filters by dragging a field to the report filters area or by using the RadPivotFieldList. Additionally, the filter menu opened by the filter button on the filter descriptor elements allows applying different filter conditions. This can be achieved by either selecting/deselecting items from the list box or by using one of the well-known filtering functions (Equals, Contains, Between, etc.).

Adding a Report Filter Description

Report filter descriptions are stored in the FilterDescriptions collection of RadPivotGrid. You can edit the contents of the collection at design time, using the Smart tag of RadPivotGrid.

Figure 1: Report Filters Designer

pivotgrid-filtering-report-filters 002

The contents of the FilterDescriptions collection can also be edited at runtime using code. The FilterDescriptions collection consists of PropertyFilterDescription instances which specify the field on which a filter is applied.

Filter Descriptions at Run-time

PropertyFilterDescription description = new PropertyFilterDescription(); 
ComparisonCondition condition = new ComparisonCondition();
condition.Condition = Comparison.Equals;
condition.Than = "UK";
description.PropertyName = "ShipCountry";
description.Condition = condition;
description.CustomName = "Country";

Dim description As New PropertyFilterDescription()
Dim condition As New ComparisonCondition()
condition.Condition = Telerik.Pivot.Core.Filtering.Comparison.Equals
condition.Than = "UK"
description.PropertyName = "ShipCountry"
description.Condition = condition
description.CustomName = "Country"

The Condition property of the PropertyFilterDescription holds the currently applied condition. It can be set with a ComparisonCondition instance as shown above or a SetCondition which allows you to include/exclude specific values:

Applying Condition

SetCondition setCondition = new SetCondition();
setCondition.Comparison = SetComparison.Includes;

Dim setCondition As New SetCondition()
setCondition.Comparison = SetComparison.Includes

See Also