Dimensions > Dimensions Assembly Interfaces > IDimAttribute > IDimAttribute.Hierarchies
Hierarchies: IDimAttributeHierarchiesList;
Hierarchies: Prognoz.Platform.Interor.Dimensions.IDimAttributeHierarchiesList;
The Hierarchies property returns collection of attribute hierarchies.
To determine whether attribute is used as alternative hierarchy, use IDimAttribute.HasHierarchy.
Executing the example requires that the repository contains a table dictionary with the DIM_SEP identifier containing attribute with the NAME identifier.
Add links to the Dimensions, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
dimension: IDimensionModel;
attribute: IDimAttribute;
attributes: IDimAttributes;
hierarchies: IDimAttributeHierarchiesList;
count: Integer;
Begin
// Get repository
mb := MetabaseClass.Active;
// Get dictionary
dimension := mb.ItemById("DIM_SEP").Edit As IDimensionModel;
// Get dictionary attributes
attributes := dimension.Attributes;
// Get the Name attribute
attribute := attributes.FindById("NAME");
// Check whether attribute is used as alternative hierarchy
If attribute.HasHierarchy Then
Debug.WriteLine("Attribute is used as alternative hierarchy")
Else
Debug.WriteLine("Attribute is not used as alternative hierarchy");
End If;
// Get attribute hierarchies
hierarchies := attribute.Hierarchies;
// Get number of hierarchies
count := hierarchies.Count;
// Display number of hierarchies to the console
Debug.WriteLine("Hierarchies number = " + count.ToString);
End Sub UserProc;
After executing the example the console displays information whether attribute is used as alternative hierarchy and the number of alternative hierarchies is also displayed.
The requirements and result of the Fore.NET example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
dimension: IDimensionModel;
attribute: IDimAttribute;
attributes: IDimAttributes;
hierarchies: IDimAttributeHierarchiesList;
count: Integer;
Begin
// Get repository
mb := Params.Metabase;
// Get dictionary
dimension := mb.ItemById["DIM_SEP"].Edit() As IDimensionModel;
// Get dictionary attributes
attributes := dimension.Attributes;
// Get the Name attribute
attribute := attributes.FindById("NAME");
// Check whether attribute is used as alternative hierarchy
If attribute.HasHierarchy Then
System.Diagnostics.Debug.WriteLine("Attribute is used as alternative hierarchy")
Else
System.Diagnostics.Debug.WriteLine("Attribute is not used as alternative hierarchy");
End If;
// Get attribute hierarchies
hierarchies := attribute.Hierarchies;
// Get number of hierarchies
count := hierarchies.Count;
// Display number of hierarchies to the console
System.Diagnostics.Debug.WriteLine("Hierarchies number = " + count.ToString());
End Sub;
See also: