GetDefaultItemIDHierarchy

Returns an array containing the path of a dimension member and its ancestors; the array contains the member IDs of the members in this path. You can return the entire path or just a portion of the path.

For example, suppose an Entity dimension member named SanFrancisco has ancestors named California, UnitedStates, and Regional, respectively. You could use GetDefaultItemIDHierarchy to return the member IDs of the entire path, or to return the member IDs of only a portion of the path, such as the portion from UnitedStates down.

Syntax

<IHsvTreeInfo>.GetDefaultItemIDHierarchy(lListID, lListTopMemberID, lItemID, lParentID, pvarItemIDHierarchy)

Argument

Description

lListID

Long (ByVal). Pass the HFMConstants type library constant MEMBER_LIST_ALL_HIERARCHY to use the default dimension hierarchy.

Caution!

If you pass a value other than MEMBER_LIST_ALL_HIERARCHY, the lListTopMemberID and lParentID arguments are ignored, and only the member ID passed in the lItemID argument is returned.

lListTopMemberID

Long (ByVal). The value you pass depends upon whether you want to return the entire path of ancestors or only a portion of the path:

  • To return the entire path of ancestors, pass the HFMConstants type library constant TREE_ROOT.

  • To return a portion of the path, pass the member ID of the topmost member that you want to return.

lItemID

Long (ByVal). The member ID of the member for which you want to return the path.

lParentID

Long (ByVal). The member ID of the parent of the lItemID member.

Tip:

For Entity dimension members with more than one parent, pass the HFMConstants type library constant MEMBERNOTUSED to have Financial Management automatically use the entity’s first parent.

pvarItemIDHierarchy

Variant array. Returns the member IDs for the path of ancestors. Note that the lItemID argument’s member ID is included at the bottom of the path.

The array is returned as a Long subtype.

Return Value

Integer. Indicates the success of the function call; returns 0 for success or -1 for an error.

Example

The following example returns the member IDs of the SanFrancisco entity’s ancestors, filtering out all members in the hierarchy above UnitedStates.

Dim cTreeIn As IHsvTreeInfo, lEnt As Long
Dim lTop As Long, lPar As Long, vaIDs, sLabel As String
Dim iRet As Integer
Set cTreeIn = m_cMetadata.Entities
lTop = cTreeIn.GetItemID("UnitedStates")
lEnt = cTreeIn.GetItemID("SanFrancisco")
lPar = cTreeIn.GetItemID("California")
cTreeIn.GetDefaultItemIDHierarchy MEMBER_LIST_ALL_HIERARCHY, _ 
lTop, lEnt, lPar, vaIDs
For i = LBound(vaIDs) To UBound(vaIDs)
  cTreeIn.GetLabel vaIDs(i), sLabel
  Debug.Print sLabel
Next i