The requested page is not available for the requested platform. You are viewing the content for Default platform.

Creating Data Extracts

The Dashboard Designer allows you to create a data extract that is a compressed snapshot of data obtained from the existing data source.

Note

Note that data extracts cannot be created for the OLAP Data Source.

Creating a Data Extract in the Data Source Wizard

To create a new data extract from the existing data source, perform the following steps.

  1. Click the New Data Source button in the Data Source ribbon tab.

    NewDataSourceButtonRibbon(Extract)

  2. On the first page of the invoked Data Source Wizard dialog, select Data extract and click Next.

    DataSourceWizard_Extract

  3. On the next page, select whether to create a new data extract or establish a connection to an existing one.

    DataSourceWizard_Extract_NewOrExisting

    • To create a new data extract, select Create a new data extract from the existing data source and specify the required Data Source and Data Member. Click Next.
    • To establish a connection to an existing data extract, select Load an existing data extract from a file and locate the required *.dat file. Click Finish.
  4. (Conditional) The next page only appears if you are creating the data extract based on the Entity Framework Data Source or Object Data Source and allows you to select the required fields.

    DataSourceWizard_Extract_SelectFields

  5. On the next page, you can specify the filter used to extract data. To learn how to specify the filter criteria, see Filter Data via the Filter Editor.

    DataSourceWizard_Extract_FilterData

    You can also limit the number of extracted rows by enabling the Limit rows to extract option and specifying the required number of rows. Click Next.

    Note

    Use the Preview button to see the data that will be placed into the resulting data extract.

  6. (Conditional) The next page only appears if the original data source contains parameters (for instance, the SQL query is filtered using a dashboard parameter).

    DataSourceWizard_Extract_SpecifyParameterValues

  7. On the final page, specify a path to the file that will contain the resulting data extract.

    DataSourceWizard_Extract_Finish

    Click Finish. This creates the data extract and displays its fields in the Data Source Browser. You can use this data extract as a regular data source.

Creating a Data Extract in Code

To generate the data extract in code, create an instance of the DashboardExtractDataSource class and specify the following properties.

Finally, add the created DashboardExtractDataSource object to the Dashboard.DataSources collection.

The following code snippet shows how to create a data extract from the existing SQL data source and add it to the collection of dashboard data sources.

using DevExpress.DashboardCommon;
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
// ...
            DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("Data Source 1", msSqlParams);
            SelectQuery selectQuery = SelectQueryFluentBuilder
                .AddTable("SalesPerson")
                .SelectColumns("CategoryName", "Extended Price")
                .Build("Query 1");
            sqlDataSource.Queries.Add(selectQuery);

            // ...

            DashboardExtractDataSource extractDataSource = new DashboardExtractDataSource();
            extractDataSource.ExtractSourceOptions.DataSource = sqlDataSource;
            extractDataSource.ExtractSourceOptions.DataMember = "Query 1";
            extractDataSource.FileName = @"C:\temp\SalesPersonExtract.dat";
            extractDataSource.UpdateExtractFile();

            dashboard.DataSources.Add(extractDataSource);