FilesMapping: IDictionary;
FilesMapping: System.Collections.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 the repository contains a regular report with the REG_REP_PUB identifier. This report should have controls that are common for all report sheets. The controls should be linked with fixed dimensions.
Add links to the Collections, Dimensions, Metabase, Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
RegRep: IPrxReport;
Exporter: IPrxReportExporter;
BulkSetting: IPrxBulkSettings;
SelSet: IPrxBulkSelectionSet;
filesDict: IDictionary;
keys: ICollection;
values: ICollection;
keysArr, valuesArr: Array;
vValue: Variant;
stringToMemo: String;
v: Variant;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get regular report
RegRep := MB.ItemById("REG_REPORT_PUB").Bind As IPrxReport;
// Create an object to export report
Exporter := New PrxReportExporter.Create;
// Specify exported report
Exporter.Report := RegRep;
// Determine selection of fixed report dimensions
SelSet := RegRep.GetBulkSelectionSet("1-2");
SelSet.Item(0).Selection.SelectElement(1, False);
SelSet.Item(0).Selection.SelectElement(2, False);
SelSet.Item(0).Selection.SelectElement(3, False);
// Determine parameters of batch export execution
BulkSetting := Exporter.BulkSettings;
BulkSetting.Enabled := True;
BulkSetting.SelectionSet := SelSet;
// Export
Exporter.ExportToFile("c:\" + RegRep.Name + ".XLS", "XLS");
// Get mapping of exported files and selection element key
filesDict := BulkSetting.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
After executing the example the console window displays mapping of selection element keys and corresponding exported files.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Report;
Imports System.Collections;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RegRep: IPrxReport;
Exporter: IPrxReportExporter;
BulkSetting: IPrxBulkSettings;
SelSet: IPrxBulkSelectionSet;
filesDict: IDictionary;
keys: ICollection;
values: ICollection;
keysArr, valuesArr: Array;
vValue: Object;
stringToMemo: String;
v: Object;
Begin
// Get current repository
MB := Params.Metabase;
// Get regular report
RegRep := MB.ItemById["REG_REPORT_PUB"].Bind() As IPrxReport;
// Create an object to export report
Exporter := New PrxReportExporter.Create();
// Determine exported report
Exporter.Report := RegRep;
// Determine selection of fixed report dimensions
SelSet := RegRep.GetBulkSelectionSet("1-2");
SelSet.Item[0].Selection.SelectElement(1, False);
SelSet.Item[0].Selection.SelectElement(2, False);
SelSet.Item[0].Selection.SelectElement(3, False);
// Determine parameters of batch export execution
BulkSetting := Exporter.BulkSettings;
BulkSetting.Enabled := True;
BulkSetting.SelectionSet := SelSet;
// Export
Exporter.ExportToFile("c:\" + RegRep.Name + ".XLS", "XLS");
// Get mapping of exported files and selection element key
filesDict := BulkSetting.FilesMapping;
// Get selection key array
keys := filesDict.Keys;
keysArr := New Object[keys.Count];
keys.CopyTo(keysArr, 0);
// Get array of exported file names
values := filesDict.Values;
valuesArr := New Object[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;
System.Diagnostics.Debug.WriteLine(stringToMemo);
End For;
End Sub;
See also: