SyncGroups: IEaxSyncGroups;
SyncGroups: Prognoz.Platform.Interop.Express.IEaxSyncGroups;
The SyncGroups property returns a group with synchronization settings.
To get data sources of regular report, use the IPrxReport.DataSources property.
Executing the example requires a regular report with the REGULAR_REPORT identifier containing two data sources, for each of them data areas are added including analytical ones. Data area dimensions are dictionaries with the CALENDAR1, SEP1 identifiers (for the first data source) and CALENDAR2, SEP2 (for the second data source).
Add links to the Express, Dimensions, Metabase, Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Rep: IPrxReport;
DataArea: IEaxDataArea;
SyncG: IEaxSyncGroups;
Group: IEaxSyncGroup;
Slices_DA: IEaxDataAreaSlices;
Slice_DA: IEaxDataAreaSlice;
Slices: IPrxSlices;
Slice: IPrxSlice;
DimKey, i, j: Integer;
Inst: IEaxDimensionInstance;
PrxDim: IPrxSliceDimension;
SliceType: EaxDimensionOwnerType;
Inst_Slice: Object;
Begin
MB := MetabaseClass.Active;
Rep := MB.ItemById("REGULAR_REPORT").Edit As IPrxReport;
// Synchronize analytical data area dimensions:
DataArea := Rep.DataArea As IEaxDataArea;
Slices_DA := DataArea.Slices;
SyncG := Rep.SyncGroups As IEaxSyncGroups;
Slice_DA := Slices_DA.Item(0);
DimKey := Slice_DA.Selection.FindById("CALENDAR1").Dimension.Key;
Inst := Slice_DA.GetDimension(DimKey);
Group := SyncG.CreateGroup(Inst);
Slice_DA := Slices_DA.Item(1);
DimKey := Slice_DA.Selection.FindById("SEP1").Dimension.Key;
Inst := Slice_DA.GetDimension(DimKey);
Group.Add(Inst);
// Synchronize data area dimensions:
Slices := Rep.DataSources.Item(1).Slices;
Slice := Slices.Item(0);
PrxDim := Slice.Dimensions.FindById("CALENDAR2");
DimKey := PrxDim.Key;
Inst := Slice.GetDimension(DimKey);
Group := SyncG.CreateGroup(Inst);
Slice := Slices.Item(1);
DimKey := Slice.Selection.FindById("SEP2").Dimension.Key;
Inst := Slice.GetDimension(DimKey);
Group.Add(Inst);
// Output synchronization results:
Debug.WriteLine("Total number of groups: " + SyncG.Count.ToString);
For i := 0 To SyncG.Count - 1 Do
Group := SyncG.Item(i);
Debug.WriteLine("=== Group " + (i + 1).ToString + " ===");
Debug.WriteLine("Dimension identifier - Slice");
For j := 0 To Group.Count - 1 Do
SliceType := Group.Item(j).Dimension.SliceType;
Inst := Group.Item(j).Dimension;
Inst_Slice := Inst.Slice;
If (SliceType = EaxDimensionOwnerType.PivotSlice) Then
Debug.WriteLine(Inst.Dimension.Ident + " - " + (Inst_Slice As IEaxDataAreaSlice).Name);
End If;
If (SliceType = EaxDimensionOwnerType.PrxSlice) Then
Debug.WriteLine(Inst.Dimension.Ident + " - " + (Inst_Slice As IPrxSlice).Name);
End If;
End For;
End For;
(Rep As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, groups of synchronized dimensions are added. The console window displays general information by each group.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Express;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Rep: IPrxReport;
DataArea: IEaxDataArea;
SyncG: IEaxSyncGroups;
Group: IEaxSyncGroup;
Slices_DA: IEaxDataAreaSlices;
Slice_DA: IEaxDataAreaSlice;
Slices: IPrxSlices;
Slice: IPrxSlice;
DimKey: uinteger;
Inst: IEaxDimensionInstance;
PrxDim: IPrxSliceDimension;
i, j: integer;
SliceType: EaxDimensionOwnerType;
Inst_Slice: Object;
Begin
MB := Params.Metabase;
Rep := MB.ItemById["REGULAR_REPORT"].Edit() As IPrxReport;
// Synchronize analytical data area dimensions:
DataArea := Rep.DataArea As IEaxDataArea;
Slices_DA := DataArea.Slices;
SyncG := Rep.SyncGroups As IEaxSyncGroups;
Slice_DA := Slices_DA.Item[0];
DimKey := Slice_DA.Selection.FindById("CALENDAR1").Dimension.Key;
Inst := Slice_DA.GetDimension(DimKey);
Group := SyncG.CreateGroup(Inst);
Slice_DA := Slices_DA.Item[1];
DimKey := Slice_DA.Selection.FindById("SEP1").Dimension.Key;
Inst := Slice_DA.GetDimension(DimKey);
Group.Add(Inst);
// Synchronize data area dimensions:
Slices := Rep.DataSources.Item[1].Slices;
Slice := Slices.Item[0];
PrxDim := Slice.Dimensions.FindById("CALENDAR2");
DimKey := PrxDim.Key;
Inst := Slice.GetDimension(DimKey);
Group := SyncG.CreateGroup(Inst);
Slice := Slices.Item[1];
DimKey := Slice.Selection.FindById("SEP2").Dimension.Key;
Inst := Slice.GetDimension(DimKey);
Group.Add(Inst);
// Output synchronization results:
System.Diagnostics.Debug.WriteLine("Total number of groups: " + SyncG.Count.ToString());
For i := 0 To SyncG.Count - 1 Do
Group := SyncG.Item[i];
System.Diagnostics.Debug.WriteLine("=== Group " + (i + 1).ToString() + " ===");
System.Diagnostics.Debug.WriteLine("Dimension identifier - Slice");
For j := 0 To Group.Count - 1 Do
SliceType := Group.Item[j].Dimension.SliceType;
Inst := Group.Item[j].Dimension;
Inst_Slice := Inst.Slice;
If (SliceType = EaxDimensionOwnerType.edotPivotSlice) Then
System.Diagnostics.Debug.WriteLine(Inst.Dimension.Ident + " - " + (Inst_Slice As IEaxDataAreaSlice).Name);
End If;
If (SliceType = EaxDimensionOwnerType.edotPrxSlice) Then
System.Diagnostics.Debug.WriteLine(Inst.Dimension.Ident + " - " + (Inst_Slice As IPrxSlice).Name);
End If;
End For;
End For;
(Rep As IMetabaseObject).Save();
End Sub;
See also: