GetDependants(S: IDimSelection;
Key: Integer;
de: Integer): Array;
GetDependants(S: Prognoz.Platform.Interop.Dimensions.IDimSelection;
Key: uinteger;
de: uinteger): System.Array;
S. Dimension selection where alternative hierarchy is placed.
Key. Unique key of analytical data area.
de. Dimension selection element.
The GetDependants method returns arrays of data transformation formulas keys from collection of alternative hierarchies of analytical data area.
The Key = -1 parameter is used if analytical area uses one slice. If more than one data slice is used, use the IEaxDataAreaHierarchies.CreateKey method to get unique key of analytical data area.
Executing the example requires that the repository contains an express report with the EXPRESS_GETDEPENDANTS identifier. The report contains:
Dimension with the DIC_RF identifier which has alternative hierarchy.
Formatted formula in the expression editor.
Add links to the Dimension, Express, Metabase, Pivot system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
DArea: IEaxDataArea;
DAHierarchies: IEaxDataAreaHierarchies;
Hierarchy: IEaxDataAreaHierarchy;
HierarchyInst: IDimHierarchyInstance;
Elements: IDimElements;
DimElArray, ElArray: IDimElementArray;
Pivot: IPivot;
DimSel: IDimSelection;
Slice: IEaxDataAreaSlice;
Key, DimElement: Integer;
GetDepArray: Array Of Integer;
ElementName: String;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
Express := MB.ItemById("EXPRESS_GETDEPENDANTS").Bind As IEaxAnalyzer;
// Get data source slice
DArea := Express.DataArea;
// Get collection of analytical area hierarchies
DAHierarchies := DArea.Hierarchies;
// Get analytical area hierarchy
Hierarchy := DAHierarchies.Item(0);
// Get alternative hierarchy data
HierarchyInst := Hierarchy.Hierarchy;
// Get selection
Pivot := Express.Pivot;
DimSel := Pivot.Selection.FindById("DIC_RF");
// Get data slice
Slice := DArea.Slices.Item(0);
// Get dimension key
Key := DAHierarchies.CreateKey(Slice.Key, HierarchyInst.Key);
// Get array of selected elements
ElArray := Dimsel.SelectedElementArray(Null);
// Get all dimension elements
Elements := ElArray.Elements;
// Get element index in dimension
DimElement := ElArray.Element(5);
// Get element name and display it to the console
ElementName := Elements.Name(DimElement);
Debug.WriteLine("Name of selected element - " + ElementName);
// Get array of data transformation formulas keys
GetDepArray := DAHierarchies.GetDependants(DimSel, Key, DimElement);
If GetDepArray <> Null Then
// Display to the console
Debug.WriteLine("Length of obtained array = " + GetDepArray.Length.ToString);
Else
Debug.WriteLine("No elements found in the array");
End If;
After executing the example the console displays name of selected element and length of obtained array.
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.Pivot;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Express: IEaxAnalyzer;
DArea: IEaxDataArea;
DAHierarchies: IEaxDataAreaHierarchies;
Hierarchy: IEaxDataAreaHierarchy;
HierarchyInst: IDimHierarchyInstance;
Elements: IDimElements;
ElArray: IDimElementArray;
Pivot: IPivot;
DimSel: IDimSelection;
Slice: IEaxDataAreaSlice;
Key, DimElement: uinteger;
GetDepArray: System.Array;
ElementName: String;
Begin
// Get repository
MB := Params.Metabase;
// Get express report
Express := MB.ItemById["EXPRESS_GETDEPENDANTS"].Bind() As IEaxAnalyzer;
// Get data source slice
DArea := Express.DataArea;
// Get collection of analytical area hierarchies
DAHierarchies := DArea.Hierarchies;
// Get analytical area hierarchy
Hierarchy := DAHierarchies.Item[0];
// Get alternative hierarchy data
HierarchyInst := Hierarchy.Hierarchy;
// Get selection
Pivot := Express.Pivot;
DimSel := Pivot.Selection.FindById("DIC_RF");
// Get data slice
Slice := DArea.Slices.Item[0];
// Get dimension key
Key := DAHierarchies.CreateKey(Slice.Key, HierarchyInst.Key);
// Get array of selected elements
ElArray := Dimsel.SelectedElementArray[Null];
// Get all dimension elements
Elements := ElArray.Elements;
// Get element index in dimension
DimElement := ElArray.Element[5];
// Get element name and display it to the console
ElementName := Elements.Name[DimElement];
System.Diagnostics.Debug.WriteLine("Name of selected element - " + ElementName);
// Get array of data transformation formulas keys
GetDepArray := DAHierarchies.GetDependants(DimSel, Key, DimElement);
If GetDepArray <> Null Then
// Display to the console
System.Diagnostics.Debug.WriteLine
("Length of obtained array = " + GetDepArray.Length.ToString());
Else
System.Diagnostics.Debug.WriteLine("No elements found in the array");
End If;
End Sub;
See also: