IDimAttributeHierarchyInstance.AttributeHierarchy

Syntax

AttributeHierarchy: IDimAttributeHierarchy;

Description

The AttributeHierarchy property returns data of attribute alternative hierarchy.

Comments

To get collection of dictionary alternative hierarchy data, use IDimInstance.AttributeHierarchies.

Example

Executing the example requires that repository contains table dictionary with the DIM_SEP identifier which alternative hierarchy consists of two levels.

Add links to the Dimensions, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    diminstance: IDimInstance;
    attrhierarchy: IDimAttributeHierarchy;
    attrhierarchies: IDimAttributeHierarchiesInstance;
    attrhierinstance: IDimAttributeHierarchyInstance;
    attrhierinstance1: IDimAttributeHierarchyInstance;
    id, name: string;
Begin
    // Get repository
    mb := MetabaseClass.Active;
    // Get dictionary data
    diminstance := mb.ItemById("DIM_SEP").Open(NullAs IDimInstance;
    // Get data of alternative hierarchy
    attrhierinstance := diminstance.AttributeHierarchies.HierarchyItem(0);
    // Get alternative hierarchy
    attrhierarchy := attrhierinstance.AttributeHierarchy;
    // Get identifier of alternative hierarchy and display to the console
    id := attrhierarchy.Id;
    Debug.WriteLine("Identifier of alternative hierarchy = " + id);
    // Get data of alternative hierarchies collection
    attrhierarchies := diminstance.AttributeHierarchies;
    // Get alternative hierarchy by attribute level
    attrhierinstance1 := attrhierarchies.FindByAttributeLevel(22);
        If attrhierinstance1 <> Null Then
            // Display name of alternative hierarchy to the console
                name := attrhierinstance1.Name;
                    Debug.WriteLine("Name of alternative hierarchy = " + name) Else
                        Debug.WriteLine("Alternative hierarchy is not found = " + name)
                            End If;
End Sub UserProc;

After executing the example the console displays identifier and name of obtained alternative hierarchies.

See also:

IDimAttributeHierarchyInstance