Skip to main content

DashboardExtractDataSource.UpdateExtractFile() Method

Updates data in the data extract file.

Namespace: DevExpress.DashboardCommon

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

NuGet Packages: DevExpress.Dashboard.Core, DevExpress.Win.Dashboard.Design


public void UpdateExtractFile()


This example demonstrates how to create the Extract Data Source, replace existing dashboard data sources with Extract Data Sources and update the Extract data file.


The DashboardViewer loads a dashboard. The dashboard is initially bound to the Microsoft SQL Server database file (.mdf) with the DashboardSqlDataSource.

The CreateExtractAndSave method creates the DashboardExtractDataSource based on the original data source, adds the newly created data source to the dashboard, iterates over dashboard items to change the data source settings, and finally saves the modified dashboard and the Extract data file.

The UpdateExtract method calls the DashboardExtractDataSource.UpdateExtractFile() method for each Extract Data Source in the dashboard.

View Example: WinForms - Dashboard with Extract Data Source

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace ExtractDataSourceExample {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            dashboardViewer1.CustomizeDashboardTitle += DashboardViewer1_CustomizeDashboardTitle;

        delegate void SafeUpdate(string file);
        private void CreateExtractAndSave() {
            DataSourceCollection dsCollection = new DataSourceCollection();
            dsCollection.AddRange(dashboardViewer1.Dashboard.DataSources.Where(d => !(d is DashboardExtractDataSource)));
            foreach (var ds in dsCollection) {
                    DashboardExtractDataSource extractDataSource = new DashboardExtractDataSource();
                    extractDataSource.ExtractSourceOptions.DataSource = ds;

                    if (ds is DashboardSqlDataSource)
                        extractDataSource.ExtractSourceOptions.DataMember = ((DashboardSqlDataSource)(ds)).Queries[0].Name;

                    extractDataSource.FileName = Path.GetFullPath($"Extract_{ds.Name}.dat");
                    foreach (DataDashboardItem item in dashboardViewer1.Dashboard.Items)
                        if (item.DataSource == ds)
                            item.DataSource = extractDataSource;

        private void UpdateExtract() {
            foreach (var ds in dashboardViewer1.Dashboard.DataSources.Where(d => d is DashboardExtractDataSource)) {

        private async void UpdateExtractAsync() {
            await dashboardViewer1.UpdateExtractDataSourcesAsync(
                (fileName, result) => { 
                (fileName, result) => { 
                    MessageBox.Show($"File {fileName} updated "); 

        void OnDataReady(string fileName) {
            dashboardViewer1.Invoke(new SafeUpdate(UpdateViewer), new object[] { fileName });
        void UpdateViewer(string fileName) {
            MessageBox.Show($"Data for the file {fileName} is ready ");

        private void DashboardViewer1_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e) {
            DashboardToolbarItem itemUpdate = new DashboardToolbarItem((args) => UpdateExtract()) {
                Caption = "Update Extract Data Source",

            DashboardToolbarItem itemUpdateAsync = new DashboardToolbarItem((args) => UpdateExtractAsync()) {
                Caption = "Async Update Extract Data Sources",

            DashboardToolbarItem itemSave = new DashboardToolbarItem((args) => CreateExtractAndSave()) {
                Caption = "Create Extract Data Source",

The following code snippets (auto-collected from DevExpress Examples) contain references to the UpdateExtractFile() method.


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