Edit and Update Extracts
- 3 minutes to read
This topic describes how to edit settings of the created data extract and update its data from the original data source.
Edit a Data Extract
To edit the created or loaded data extract, click the Edit Extract button in the Data Source ribbon tab.
This invokes the Edit Extract form that replicates the functionality of the Data Source wizard for the Extract Data Source.
You can either change the original data source or you can load another data extract from the file.
Update a Data Extract
To update the data extract from the original data source, click the Update button in the Data Source ribbon tab.
In the invoked Confirmation dialog, click Yes to update the extract data or click No to cancel the update process.
Edit an Original Data Source
The Extract Data Source also allows you to change settings of the original data source’s copy. For instance, you can edit connection or query settings for SQL data sources. To do this, use buttons from the Extract Source group in the Data Source ribbon tab.
For other data source types, use the Edit Extract Source button.
Clicking this button invokes the Data Source Wizard specific to the original data source type (for instance, the Excel Data Source or Object Data Source).
Edit and Update the Extract Data Source in Code
ExtractDataSource API
To get access to the original data source, use the ExtractDataSource.ExtractSourceOptions.DataSource property.
To update the extract data source, call the following methods:
Method | Description |
---|---|
DashboardExtractDataSource.UpdateExtractFile | Updates data in the data extract file. |
DashboardViewer.UpdateExtractDataSourcesAsync | Updates the specified extract data sources in the current dashboard asynchronously. Allows you to set custom actions to perform after updating the data and file. |
DashboardDesigner.UpdateExtractDataSourcesAsync | Updates the specified extract data sources in the current dashboard asynchronously. Allows you to set custom actions to perform after updating the data and file. |
DashboardControl.UpdateExtractDataSourcesAsync | Updates the specified extract data sources in the current dashboard asynchronously. Allows you to specify custom actions to perform after updating the data and file. |
The following code snippet implements the UpdateExtractAsync method that updates all extract files bound to the dashboard. It displays a message box and reloads DashboardViewer’s data when data is updated, and displays a message box when the extract files are updated.
delegate void SafeUpdate(string file);
private async void UpdateExtractAsync() {
await dashboardViewer1.UpdateExtractDataSourcesAsync(
(fileName, result) => {
OnDataReady(fileName);
},
(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 ");
dashboardViewer1.ReloadData();
}
Edit Extract Dialog
To invoke the Edit Extract form, call the ExtractDataSourceUIHelper.EditExtractOptions(DashboardExtractDataSource, EditExtractOptionsContext) method, as illustrated in the following code snippet:
private void UpdateExtract()
{
DashboardExtractDataSource extractDS = dashboardViewer1.Dashboard.DataSources[0] as DashboardExtractDataSource;
if (extractDS != null)
{
EditExtractOptionsContext optionsContext =
new EditExtractOptionsContext(this.GetActiveLookAndFeel(), this, dashboardViewer1.Dashboard.DataSources);
ExtractDataSourceUIHelper.EditExtractOptions(extractDS, optionsContext);
}
dashboardViewer1.ReloadData();
}