SelectionSet: IAdhocBulkSelectionSet;
The SelectionSet property returns the selection of fixed dimensions, according to which dashboard variants for executing a batch operation will be created.
The number of dashboard variants, for which the operation will be executed, is equal to Cartesian product of the selected elements in dimensions.
Executing the example requires a form containing the Button component with the Button1 identifier, the DimensionTree component with the DimensionTree1 identifier and the UiDimension component with the UiDimension1 identifier. Specify UiDimension1 as the data source for the DimensionTree1 component. The repository must contain a dashboard with the AN_PANEL name.
The example is a handler of the OnClick event for the Button1 component.
Add links to the Dimensions and Metabase system assemblies.
Class TESTForm: Form
Button1: Button;
UiDimension1: UiDimension;
DimensionTree1: DimensionTree;
adhoc: IAdhocReport;
adhoc_dim: IAdhocDsoDimension;
sel: IDimSelection;
Sub TESTFormOnCreate(Sender: Object; Args: IEventArgs);
Begin
// Get selection
adhoc := MetabaseClass.Active.ItemById("AN_PANEL").Edit As IAdhocReport;
adhoc_dim := adhoc.Synchronization.Dimensions.Item(0).Dimensions.Item(0).Dimension;
UiDimension1.Instance := adhoc_dim.Selection.Dimension;
sel := UiDimension1.Selection;
End Sub TESTFormOnCreate;
…
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
exp: IAdhocReportExporter;
bulk: IAdhocBulkSettings;
bulk_sel: IAdhocBulkSelection;
bulk_sel_set: IAdhocBulkSelectionSet;
Begin
// Execute export
exp := New AdhocReportExporter.Create;
exp.AdhocReport := adhoc;
bulk := New AdhocBulkSettings.Create;
exp.BulkSettings := bulk;
bulk.Enabled := True;
bulk_sel_set := bulk.SelectionSet;
bulk_sel := bulk_sel_set.Add(adhoc_dim);
sel.CopyTo(bulk_sel.Selection, True);
exp.ExportToFile("C:\Result.xls", "XLS");
End Sub Button1OnClick;
End Class TESTForm ;
After executing the example the dashboard data will be exported to the "C:\Result.xls" file.
See also: