IPivot.AddHierarchy

Syntax

AddHierarchy(Value: IDimHierarchyInstance);

Parameters

Value. Data of dictionary alternative hierarchy.

Description

The AddHierarchy method adds an alternative hierarchy to the collection.

Comments

To remove the alternative hierarchy from the collection, use the IPivot.RemoveHierarchy method.

To get whether the specified hierarchy is in the collection, use the IPivot.ContainsHierarchy property.

Example

Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier. A data source should be selected in express report - a standard cube that includes a table MDM dictionary with the DIM identifier containing at least one alternative hierarchy.

Add links to the Dimensions, Express, Metabase, Pivot system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj, Dimension: IMetabaseObject;
    Express: IEaxAnalyzer;
    Pivot: IPivot;
    DimModel: IDimensionModel;
    DimInstance: IDimInstance;
    Hierarchies: IDimHierarchies;
    Hierarchy: IDimHierarchy;
    HierarchiesInstance: IDimHierarchiesInstance;
    HierarchyInstance: IDimHierarchyInstance;
Begin
    MB := MetabaseClass.Active;
    // Get express report
    MObj := MB.ItemById("EXPRESS_REPORT").Edit;
    Express := MObj As IEaxAnalyzer;
    // Get dictionary alternative hierarchy
    Dimension := MB.ItemById("DIM").Bind;
    DimModel := Dimension As IDimensionModel;
    Hierarchies := DimModel.Hierarchies;
    Hierarchy := Hierarchies.Item(0);
    // Get alternative hierarchy data
    DimInstance := Dimension.Open(NullAs IDimInstance;
    HierarchiesInstance := DimInstance.Hierarchies;
    HierarchyInstance := HierarchiesInstance.Item(0);
    // Get express report table
    Pivot := Express.Pivot;
    // Add an alternative hierarchy if it is not contained in the collection
    If Pivot.ContainsHierarchy(Hierarchy) = False Then
        Pivot.AddHierarchy(HierarchyInstance);
    End If;
    // Save changes
    MObj.Save;
End Sub UserProc;

After executing the example, an alternative hierarchy is added to the express report as an additional dimension in the Selection group of tabs.

See also:

IPivot