Skip to content

hierarchy.elementHasAncestor ​

Checks whether an element has another element anywhere above it in a hierarchy, not just as its immediate parent.

js
hierarchy.elementHasAncestor(dimension, hierarchy, element, ancestorName)

Parameters ​

ParameterTypeDescription
dimensionstringThe dimension's name or id.
hierarchystringThe hierarchy's name or id.
elementstringThe element to check.
ancestorNamestringThe ancestor to look for. It can be prefixed with the hierarchy.

Returns ​

boolean

true when the ancestor is found above the element, otherwise false.

Examples ​

js
const value = hierarchy.elementHasAncestor("Time", "Default (Calendar)", "August", "2015");