Back to Devexpress

Data Analysis Filters

wpf-401355-controls-and-libraries-data-grid-filtering-and-searching-data-analysis-filters.md

latest5.7 KB
Original Source

Data Analysis Filters

  • Jun 24, 2020
  • 3 minutes to read

The GridControl allows you to apply Data Analysis Filters - numerical filters that do not have corresponding comparison operators.

Overview

The following data analysis filters are available:

Top / Bottom N

Displays a specific number of topmost/bottom-most values. You can specify this number as an absolute or percentage value.

Above / Below Average

Displays values that are above/below an average value.

Unique / Duplicate

Displays unique/duplicate values.

Apply Data Analysis Filters

Filter Editor

Select data analysis filters in the Filter Editor:

Excel-style Drop-down Filter

Select data analysis filters in the Excel-style Drop-down Filter:

In Code

Use the DataControlBase.FilterString property to apply data analysis filters in code:

csharp
grid.FilterString = "[#TopItems]([Profit], 10)"; // Profit in Top 10 Items
grid.FilterString = "[#TopPercent]([Profit], 10)"; // Profit in Top 10%
grid.FilterString = "[#BottomItems]([Profit], 10)"; // Profit in Bottom 10 Items
grid.FilterString = "[#BottomPercent]([Profit], 10)"; // Profit in Bottom 10%
grid.FilterString = "[#AboveAverage]([Profit])"; // Profit Above Average
grid.FilterString = "[#BelowAverage]([Profit])"; // Profit Below Average
grid.FilterString = "[#Unique]([Profit])"; // Profit is Unique
grid.FilterString = "[#Duplicate]([Profit])"; // Profit is Duplicate
vb
grid.FilterString = "[#TopItems]([Profit], 10)" 'Profit in Top 10 Items
grid.FilterString = "[#TopPercent]([Profit], 10)" 'Profit in Top 10%
grid.FilterString = "[#BottomItems]([Profit], 10)" 'Profit in Bottom 10 Items
grid.FilterString = "[#BottomPercent]([Profit], 10)" 'Profit in Bottom 10%
grid.FilterString = "[#AboveAverage]([Profit])" 'Profit Above Average
grid.FilterString = "[#BelowAverage]([Profit])" 'Profit Below Average
grid.FilterString = "[#Unique]([Profit])" 'Profit is Unique
grid.FilterString = "[#Duplicate]([Profit])" 'Profit is Duplicate

You can also use the DataControlBase.FilterCriteria property:

csharp
grid.FilterCriteria = new FunctionOperator("#TopItems", new OperandProperty("Profit"), new OperandValue(10)); // Profit in Top 10 Items
grid.FilterCriteria = new FunctionOperator("#TopPercent", new OperandProperty("Profit"), new OperandValue(10)); // Profit in Top 10%
grid.FilterCriteria = new FunctionOperator("#BottomItems", new OperandProperty("Profit"), new OperandValue(10)); // Profit in Bottom 10 Items
grid.FilterCriteria = new FunctionOperator("#BottomPercent", new OperandProperty("Profit"), new OperandValue(10)); // Profit in Bottom 10%
grid.FilterCriteria = new FunctionOperator("#AboveAverage", new OperandProperty("Profit")); // Profit Above Average
grid.FilterCriteria = new FunctionOperator("#BelowAverage", new OperandProperty("Profit")); // Profit Below Average
grid.FilterCriteria = new FunctionOperator("#Unique", new OperandProperty("Profit")); // Profit is Unique
grid.FilterCriteria = new FunctionOperator("#Duplicate", new OperandProperty("Profit")); // Profit is Duplicate
vb
grid.FilterCriteria = New FunctionOperator("#TopItems", New OperandProperty("Profit"), New OperandValue(10)) 'Profit in Top 10 Items
grid.FilterCriteria = New FunctionOperator("#TopPercent", New OperandProperty("Profit"), New OperandValue(10)) 'Profit in Top 10%
grid.FilterCriteria = New FunctionOperator("#BottomItems", New OperandProperty("Profit"), New OperandValue(10)) 'Profit in Bottom 10 Items
grid.FilterCriteria = New FunctionOperator("#BottomPercent", New OperandProperty("Profit"), New OperandValue(10)) 'Profit in Bottom 10%
grid.FilterCriteria = New FunctionOperator("#AboveAverage", New OperandProperty("Profit")) 'Profit Above Average
grid.FilterCriteria = New FunctionOperator("#BelowAverage", New OperandProperty("Profit")) 'Profit Below Average
grid.FilterCriteria = New FunctionOperator("#Unique", New OperandProperty("Profit")) 'Profit is Unique
grid.FilterCriteria = New FunctionOperator("#Duplicate", New OperandProperty("Profit")) 'Profit is Duplicate

Limitations