CreateSyncGroup(SyncItem: IEaxDimensionDescriptor): IEaxSyncGroup;;
CreateSyncGroup(SyncItem: Prognoz.Platform.Interop.Express.IEaxDimensionDescriptor):
Prognoz.Platform.Interop.Express.IEaxSyncGroup;;
SyncItem. Dimension description.
The CreateGroup method creates a link of link.
To remove the synchronized dimensions link by its index, use IEaxSyncGroups.Remove.
Executing the example requires that the repository contains regular report with the REG_SYNCGROUPS identifier containing two analytical data areas based on the same source. Data source should obligatory contain calendary dimension based on calendar dictionary with the D_CALENDAR identifier and territory dimension based on territory dimension with the DIC_RF identifier.
Add links to the Dimensions, Express, Metabase, Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
RepGrid: IEaxGrid;
SelManager: IEaxObjectSelectionManager;
SliceA, SliceB: IEaxDataAreaSlice;
CalDimKey_A, TerDimKey_A, CalDimKey_B, TerDimKey_B, i, Key, Count: Integer;
CalInst_A, TerInst_A, CalInst_B, TerInst_B: IEaxDimensionInstance;
SGroups: IEaxSyncGroups;
Group_a, Group_b, SG: IEaxSyncGroup;
Compatible: IEaxDimensionDescriptors;
DimName, SyncAttr: String;
SyncItem: IEaxSyncItem;
Begin
MB := MetabaseClass.Active;
// Get report
Report := MB.ItemById("REG_SYNCGROUPS").Edit As IPrxReport;
// Get object to work with table
DataArea := Report.DataArea;
RepGrid := DataArea.Views.Item(0) As IEaxGrid;
SelManager := RepGrid.SelectionManager;
// Set up synchronization of the first slice dimensions
SliceA := Report.DataArea.Slices.Item(0);
CalDimKey_A := SliceA.Selection.FindById("D_CALENDAR").Dimension.Key;
CalInst_A := SelManager.GetDimension(CalDimKey_A);
TerDimKey_A := SliceA.Selection.FindById("DIC_RF").Dimension.Key;
TerInst_A := SelManager.GetDimension(TerDimKey_A);
SGroups := Report.SyncGroups;
Group_a := SGroups.CreateGroup(CalInst_A);
Group_b := SGroups.CreateGroup(TerInst_A);
SyncItem := Group_a.Add(CalInst_A);
SyncItem := Group_b.Add(TerInst_A);
// Set up synchronization of the second slice dimension
SliceB := Report.DataArea.Slices.Item(1);
CalDimKey_B := SliceB.Selection.FindById("D_CALENDAR").Dimension.Key;
CalInst_B := SliceB.GetDimension(CalDimKey_B);
TerDimKey_B := SliceB.Selection.FindById("DIC_RF").Dimension.Key;
TerInst_B := SliceB.GetDimension(TerDimKey_B);
Compatible := SGroups.GetCompatibleItems(CalInst_A, "");
DimName := SliceA.Selection.FindById("D_CALENDAR").Dimension.Name;
Debug.WriteLine("Number of links for which this dimension is convenient = " + Compatible.Count.ToString);
If SGroups.IsDimensionsCompatible(CalInst_A, "", CalInst_B, "") Then
Group_a.Add(CalInst_B);
Else
Return;
End If;
If SGroups.IsDimensionsCompatible(TerInst_A, "", TerInst_B, "") Then
Group_b.Add(TerInst_B);
Else
Return;
End If;
// Get link elements of territory dimension
SG := SGroups.InGroup(TerInst_B);
SG.PropogateChanges(TerInst_B);
For i := 0 To SG.Count - 1 Do
SyncItem := SG.Item(i);
// Determine that link only receives the selection
SyncItem.SyncDirection := EaxDimensionSynchronizationDirection.ConsumeChangesOnly;
SyncAttr := SyncItem.SyncAttribute;
Count := SyncItem.SyncGroup.Count;
Key := SyncItem.Dimension.DimKey;
Debug.WriteLine("Number of link elements = " + Count.ToString);
Debug.WriteLine("Dimension key - " + Count.ToString);
If SyncAttr.Length > 0 Then
Debug.WriteLine("Synchronization attribute - " + SyncAttr);
Else
Debug.WriteLine("No synchronization by attribute");
End If;
End For;
// Save changes
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example two links for dimension synchronization will be created. The first link is for calendar dimension, the second link is for territory dimension.
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.Express;
Imports Prognoz.Platform.Interop.Report;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
RepGrid: IEaxGrid;
SelManager: IEaxObjectSelectionManager;
SliceA, SliceB: IEaxDataAreaSlice;
CalDimKey_A, TerDimKey_A, CalDimKey_B, TerDimKey_B, Key: uinteger;
i, Count: Integer;
CalInst_A, TerInst_A, CalInst_B, TerInst_B: IEaxDimensionInstance;
SGroups: IEaxSyncGroups;
Group_a, Group_b, SG: IEaxSyncGroup;
Compatible: IEaxDimensionDescriptors;
DimName, SyncAttr: String;
SyncItem: IEaxSyncItem;
Begin
MB := Params.Metabase;
// Get report
Report := MB.ItemById["REG_SYNCGROUPS"].Edit() As IPrxReport;
// Get object to work with table
DataArea := Report.DataArea;
RepGrid := DataArea.Views.Item[0] As IEaxGrid;
SelManager := RepGrid.SelectionManager;
// Set up synchronization of the first slice dimensions
SliceA := Report.DataArea.Slices.Item[0];
CalDimKey_A := SliceA.Selection.FindById("D_CALENDAR").Dimension.Key;
CalInst_A := SelManager.GetDimension(CalDimKey_A);
TerDimKey_A := SliceA.Selection.FindById("DIC_RF").Dimension.Key;
TerInst_A := SelManager.GetDimension(TerDimKey_A);
SGroups := Report.SyncGroups;
Group_a := SGroups.CreateGroup(CalInst_A);
Group_b := SGroups.CreateGroup(TerInst_A);
SyncItem := Group_a.Add(CalInst_A);
SyncItem := Group_b.Add(TerInst_A);
// Set up synchronization of the second slice dimension
SliceB := Report.DataArea.Slices.Item[1];
CalDimKey_B := SliceB.Selection.FindById("D_CALENDAR").Dimension.Key;
CalInst_B := SliceB.GetDimension(CalDimKey_B);
TerDimKey_B := SliceB.Selection.FindById("DIC_RF").Dimension.Key;
TerInst_B := SliceB.GetDimension(TerDimKey_B);
Compatible := SGroups.GetCompatibleItems(CalInst_A, "");
DimName := SliceA.Selection.FindById("D_CALENDAR").Dimension.Name;
System.Diagnostics.Debug.WriteLine("Number of links for which this dimension is convenient = " + Compatible.Count.ToString());
If SGroups.IsDimensionsCompatible(CalInst_A, "", CalInst_B, "") Then
Group_a.Add(CalInst_B);
Else
Return;
End If;
If SGroups.IsDimensionsCompatible(TerInst_A, "", TerInst_B, "") Then
Group_b.Add(TerInst_B);
Else
Return;
End If;
// Get link elements of territory dimension
SG := SGroups.InGroup(TerInst_B);
SG.PropogateChanges(TerInst_B);
For i := 0 To SG.Count - 1 Do
SyncItem := SG.Item[i];
// Determine that link only receives the selection
SyncItem.SyncDirection := EaxDimensionSynchronizationDirection.edsdConsumeChangesOnly;
SyncAttr := SyncItem.SyncAttribute;
Count := SyncItem.SyncGroup.Count;
Key := SyncItem.Dimension.DimKey;
System.Diagnostics.Debug.WriteLine("Number of link elements = " + Count.ToString());
System.Diagnostics.Debug.WriteLine("Dimension key - " + Count.ToString());
If SyncAttr.Length > 0 Then
System.Diagnostics.Debug.WriteLine("Synchronization attribute - " + SyncAttr);
Else
System.Diagnostics.Debug.WriteLine("No synchronization by attribute");
End If;
End For;
// Save changes
(Report As IMetabaseObject).Save();
End Sub;
See also: