Using hierarchies in the Application Engine object model OlapApi

The class OlapHierarchies that serves as a collection of OlapHierarchy is part of the Application Engine object model OlapApi. Every dimension keeps a list of OlapHierarchy and each of them caches OlapElements that belong to a particular hierarchy. As a consequence, every OlapElement has a reference to the OlapHierarchy that it belongs to.

This implies that searching for parent or child elements of element E is performed on the hierarchy that is referenced by E.

Every OlapElement that is returned by calling the function OLAPGetElementList contains its owner hierarchy:

OlapElementList OLAPGetElementList(OlapConnection connection, string dimension, string hierarchy, bool onlyBaseElements, bool cache, bool throwException)

Therefore, the list of parent elements of such an element that is returned by calling the function OLAPGetParentElementList can be retrieved from the hierarchy of the element:

public OlapElementList OLAPGetParentElementList(OlapConnection connection, OlapElement element)

If an element is retrieved by calling the function OLAPGetElementList without hierarchy parameter, then the element references the default hierarchy and the parent elements are also searched in the default hierarchy.