FilesMapping: IDictionary;
The FilesMapping property determines mapping of selection element keys and corresponding files.
This property is useful, for example, if it is necessary to determine which exported files corresponds to a selection on executing batch export.
Executing the example requires that a repository contains express report with the REPORT_MAPPING identifier. This report should use data sources containing one or several fixed dimensions general for all sheets and which are not metrics.
Add links to the Collections, Dimensions, Express, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
eExp: IEaxAnalyzer;
eExporter: IExAnalyzerExporter;
eBulkSetting: IEaxBulkSettings;
SelSet: IDimSelectionSet;
filesDict: IDictionary;
keys: ICollection;
values: ICollection;
keysArr, valuesArr: Array;
vValue: Variant;
stringToMemo: String;
v: Variant;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get report
eExp := MB.ItemById("REPORT_MAPPING").Bind As IEaxAnalyzer;
// Create object to export report
eExporter := New ExAnalyzerExporter.Create;
// Determine exported report
eExporter.ExAnalyzer := eExp;
// Determine selection of fixed report dimensions
SelSet := eExp.BulkSelectionSet;
SelSet.Item(0).SelectElement(1, False);
SelSet.Item(0).SelectElement(2, False);
SelSet.Item(0).SelectElement(3, False);
// Determine parameters of batch export execution
eBulkSetting := eExporter.BulkSettings;
eBulkSetting.Enabled := True;
eBulkSetting.SelectionSet := SelSet;
// Export
eExporter.ExportToFile("c:\" + eExp.Name + ".XLS", "XLS");
// Get mapping of exported files and selection element key
filesDict := eBulkSetting.FilesMapping;
// Get selection key array
keys := filesDict.Keys;
keysArr := New Variant[keys.Count];
keys.CopyTo(keysArr, 0);
// Get array of exported file names
values := filesDict.Values;
valuesArr := New Variant[values.Count];
values.CopyTo(valuesArr, 0);
// Display mapping of selection element keys and
// corresponding exported files
For Each v In keysArr Do
vValue := filesDict.Item(v);
stringToMemo := "Key: " + v + " ---> Value: " + vValue;
Debug.WriteLine(stringToMemo);
End For;
End Sub UserProc;
After executing the example the console window displays mapping of selection element keys and corresponding exported files.
See also: