Skip to content

hierarchy.parentByIndex ​

Returns the name of one of an element's immediate parents.

js
hierarchy.parentByIndex(dimension, hierarchy, element, index)

Parameters ​

ParameterTypeDescription
dimensionstringThe dimension's name or id.
hierarchystringThe hierarchy's name or id.
elementstringThe element's name.
indexnumberThe parent's position, starting at 0.

Returns ​

string

The parent's name, or a message starting with "Error:" when there's no parent at that position or something can't be found.

Examples ​

js
const parent = hierarchy.parentByIndex("Account", "Management Profit and Loss", "EBIT", 0);

parent is the name of the first parent of EBIT in the Management Profit and Loss hierarchy.