Skip to main content

DashboardExtractDataSource.Filter Property

Specifies the logical expression that filters data to be displayed in a dashboard.

Namespace: DevExpress.DashboardCommon

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

NuGet Package: DevExpress.Dashboard.Core

Declaration

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

Property Value

Type Default Description
String null

The logical expression that filters data to be displayed in a dashboard.

Remarks

The Filter property affects which data should be displayed in a dashboard. Users can change this filter in the Dashboard Designer.

You can also limit data to include in the extract data source. For this, use the ExtractSourceOptions.Filter property.

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.

Implements

See Also