EnumMembers2

Returns an array containing the member IDs of the dimension members in either the default dimension hierarchy, a static member list, or a dynamic member list for given Scenario, Year, Period, and Entity dimension members. The value passed to the lListID argument determines whether the returned IDs are from the default hierarchy or from a member list.

For the Entity dimension, EnumMembers2 returns child entity member IDs in the pvaralItemIDs argument and the corresponding parent member IDs in the pvaralParentIDs argument. For the other dimensions, EnumMembers2 returns members in the pvaralItemIDs argument, and the pvaralParentIDs argument is left uninitialized.

Note:

You can also return members from the default dimension hierarchy or from a static member list with EnumMembers, which does not take member IDs of Scenario, Year, and Period dimension members.

Syntax

<IHsvTreeInfo>.EnumMembers2 lListID, lListTopMemberID, lScenario, lYear, lPeriod, lEntity, pvaralItemIDs, pvaralParentIDs

Argument

Description

lListID

Long (ByVal). Identifies either a member list or the default dimension hierarchy. Pass a valid list ID to return the members in a member list, or the HFMConstants type library constant MEMBER_LIST_ALL_HIERARCHY to return the members in the default hierarchy.

Tip:

You can get member list IDs with GetMemberListID.

lListTopMemberID

Long (ByVal). The usage of this argument depends on what you pass to the lListID argument:

  • If you pass MEMBER_LIST_ALL_HIERARCHY to lListID, you can return either member IDs for all of the dimension’s members by passing the TREE_ROOT constant, or member IDs for a node’s members by passing the member ID of the node’s parent.

  • If you pass anything other than MEMBER_LIST_ALL_HIERARCHY to lListID, the lListTopMemberID argument is ignored. Because this argument is not optional, you must still pass a valid Long.

lScenario

Long (ByVal). The member ID of the Scenario dimension member for a dynamic member list.

lYear

Long (ByVal). The member ID of the Year dimension member for a dynamic member list.

lPeriod

Long (ByVal). The member ID of the Period dimension member for a dynamic member list.

lEntity

Long (ByVal). The member ID of the Entity dimension member for a dynamic member list.

Note:

This argument was added to EnumMembers2 in Release 4.0. If you have code that requires EnumMembers2 to function as it did prior to Release 4.0, pass -1.

pvaralItemIDs

Variant array. For the Entity dimension, this argument returns the member IDs of the child entities. For the other dimensions, this argument returns the member IDs of the dimension members.

The array is returned as a Long subtype.

pvaralParentIDs

Variant array. For the Entity dimension, this argument returns the member IDs of the parents of the members returned in the pvaralItemIDs argument. The array is returned as a Long subtype.

For the other dimensions, an empty Variant is returned.

Example

The following function returns an array containing the members in an Entity dimension dynamic member list for a given scenario, year, and period. In the array, the parent and child entities are delimited by periods.

Function getDynamicList(lScen As Long, lYear As Long, _
   lPer As Long) As Variant
Dim cIHsvTreeInfo As IHsvTreeInfo, lListID As Long
Dim vaChildIDs, vaParIDs, vaRet()
Dim sLabel As String, sParLabel As String
'm_cHsvMetadata is an HsvMetadata object
Set cIHsvTreeInfo = g_cMetadata.Entities
cIHsvTreeInfo.GetMemberListID "Dynamic", lListID
cIHsvTreeInfo.EnumMembers2 lListID, -1, lScen, lYear, lPer, _
   MEMBERNOTUSED, vaChildIDs, vaParIDs
ReDim vaRet(UBound(vaChildIDs))
For i = LBound(vaChildIDs) To UBound(vaChildIDs)
   cIHsvTreeInfo.GetLabel CLng(vaParIDs(i)), sParLabel
   cIHsvTreeInfo.GetLabel CLng(vaChildIDs(i)), sLabel
   vaRet(i) = sParLabel & "." & sLabel
Next i
getDynamicList = vaRet
End Function