Skip to main content

ExtractSourceOptions.Filter Property

Specifies the logical expression that filters rows to be included in the extract data source.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v23.2.Core.dll

NuGet Package: DevExpress.Dashboard.Core

Declaration

[Browsable(true)]
[DefaultValue(null)]
public string Filter { get; set; }

Property Value

Type Default Description
String null

The logical expression that filters rows to be included in the extract data source.

Property Paths

You can access this nested property as listed below:

Object Type Path to Filter
DashboardExtractDataSource

Remarks

You can limit data that is included in a data extract. For this, create an expression that specifies which rows should be included in the data extract from the original data source. Then, assign the expression to the Filter property.

Use the DashboardExtractDataSource.Filter property to filter data that is displayed in a dashboard.

Example

The following code sample shows how to create a data extract from the Excel data source and filter the extracted data:

ExtractSourceOptions.Filter
Specifies the [CategoryName] = 'Beverages' expression. This expression allows you to include only rows related to the Beverages category in the data extract.
DashboardExtractDataSource.Filter
Filters data loaded to a dashboard from the created extract data source. The following expressions allows you to display only the Chai product: [ProductName] = 'Chai'.

As a result, the Grid dashboard item displays the sales of the Chai product from the Beverages category for each seller:

extract-filtering-example

using DevExpress.DashboardCommon;

namespace ExtractFiltering {
    public partial class DesignerForm1 : DevExpress.XtraBars.Ribbon.RibbonForm {
        public DesignerForm1() {
            InitializeComponent();
            dashboardDesigner.CreateRibbon();
            dashboardDesigner.LoadDashboard(@"Dashboards\dashboard1.xml");
            // Creates an origin Excel Data Source.
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource() {
                FileName = @"..\..\Data\SalesPerson2.xlsx",
                SourceOptions = new DevExpress.DataAccess.Excel.ExcelSourceOptions (
                new DevExpress.DataAccess.Excel.ExcelWorksheetSettings() {
                    WorksheetName = "Sheet1",
                })
            };
            // Creates a data extract based on the Excel Data Source.
            DashboardExtractDataSource dataExtract = new DashboardExtractDataSource();
            dataExtract.ExtractSourceOptions.DataSource = excelDataSource;
            dataExtract.FileName = @"..\..\Data\Extract1.dat";
            // Includes only "Beverages" rows from the "CategoryName" table to the Extract Data Source.
            dataExtract.ExtractSourceOptions.Filter = "[CategoryName] = 'Beverages'";
            // Limits displayed products from the "Beverages" category to "Chai".
            dataExtract.Filter = "[ProductName] = 'Chai'";
            dataExtract.UpdateExtractFile();
            // Adds the Extract Data Source to the dashboard. 
            dashboardDesigner.Dashboard.DataSources.Add(dataExtract);
        }
    }
}

Refer to the following topic for more information on how to build filter criteria: Expression Constants, Operators, and Functions.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Filter property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also