HierarchyIndex

HierarchyIndex returns the 1-based index of the specified hierarchy among the hierarchies from the given dimension that are referenced in the current cell being evaluated (rule context). Returns 0 if the hierarchy is not part of the current cell.

HierarchyIndex cannot be used in TurboIntegrator processes. The presence of this function in a process will prevent the process from compiling.

Syntax

HierarchyIndex (DimName, HierName);

Argument

Description

DimName

A valid dimension name.

HierName

A valid hierarchy name that you want to find the index position of in DimName.

Example

  • Counting hierarchies in the current cell context
    Cube C1 has:
    • Dimension D1 with hierarchies D1H1, D1H2, D1H3
    • Dimension D2 with hierarchies D2H1, D2H2

    Cell coordinates: [D1H1M1, D1H2M1, D2H1M1]

    Results:
    HIERARCHYINDEX('D1', 'D1H1') = 1   // example; actual order not guaranteed
    HIERARCHYINDEX('D1', 'D1H2') = 2
    HIERARCHYINDEX('D1', 'D1H3') = 0   // not in context
    HIERARCHYINDEX('D2', 'D2H1') = 1
    HIERARCHYINDEX('D2', 'D2H2') = 0
  • Single hierarchy per dimension

    If the cell only references: [D1H1M1, D2H1M1]

    Results:
    HIERARCHYINDEX('D1', 'D1H1') = 1
    HIERARCHYINDEX('D2', 'D2H1') = 1