EnumChildren

Returns an array of the member IDs, labels, descriptions, or number of children of the specified dimension member’s children. A flag specifies which of these types of information will be returned.

Syntax

<HFMwDimension>.EnumChildren (varOBPScenario, varOBPYear, varOBPPeriod, varParentMember, lStartingIndex, lMaxMembers, lFlagsRequestedInfo, pvaravarlMemberIDs, pvaravarbstrMemberLabels, pvaravarbstrDescriptions, pvaravarlNumChildren, pvarlTotalMembersInEnum)

Argument

Description

varOBPScenario

Pass one of the following:

  • For Organization by Period enumerations, pass the member ID or label of the Scenario dimension member.

  • For non-Organization by Period enumerations, pass -1.

    Note:

    An ID must be cast as a Long subtype.

Input argument.

varOBPYear

Pass one of the following:

  • For Organization by Period enumerations, pass the member ID or label of the Year dimension member.

  • For non-Organization by Period enumerations, pass -1.

    Note:

    An ID must be cast as a Long subtype.

Input argument.

varOBPPeriod

Pass one of the following:

  • For Organization by Period enumerations, pass the member ID or label of the Period dimension member.

  • For non-Organization by Period enumerations, pass -1.

    Note:

    An ID must be cast as a Long subtype.

Input argument.

varParentMember

Specifies the member for which you want to return children. You can pass either a member ID or a member label.

Note:

An ID must be cast as a Long subtype.

Input argument.

lStartingIndex

Specifies the starting index (base 0) of the child members to return from the total set of the parent’s children. You can use this and the lMaxMembers argument to return subsets of children with iterative calls.

Caution!

On the first call to EnumChildren for a parent, this argument defaults to 0, meaning that any non-zero value will be ignored by the first call.

Input argument. Long subtype.

lMaxMembers

Specifies the maximum number of members to return. To return all child members, pass 0.

To return a subset of the parent’s children, use this argument with the lStartingIndex argument. For example, suppose a parent entity has 1000 children, and you want to return 100 at a time. You could use a loop that makes iterative calls to EnumChildren, passing 100 to lMaxMembers and incrementing lStartingIndex by 100 in each call.

Input argument. Long subtype.

lFlagsRequestedInfo

Specifies the type of information to return. Valid values are represented by the HFMConstants type library constants listed in Metadata Information Constants. You can pass more than one constant by using Or.

Input argument. Long subtype.

pvaravarlMemberIDs

If WEBOM_METADATA_INFO_ID or WEBOM_METADATA_INFO_ALL is passed to the lFlagsRequestedInfo argument, this returns an array of the member IDs of the children.

Output argument.

pvaravarbstrMemberLabels

If WEBOM_METADATA_INFO_LABEL or WEBOM_METADATA_INFO_ALL is passed to the lFlagsRequestedInfo argument, this returns an array of the labels of the children.

Output argument.

pvaravarbstrDescriptions

If WEBOM_METADATA_INFO_DESCRIPTION or WEBOM_METADATA_INFO_ALL is passed to the lFlagsRequestedInfo argument, this returns an array of the descriptions of the children.

Output argument.

pvaravarlNumChildren

If WEBOM_METADATA_INFO_NUMCHILDREN or WEBOM_METADATA_INFO_ALL is passed to the lFlagsRequestedInfo argument, this returns an array indicating the number of child members for each enumerated child.

Output argument.

pvarlTotalMembersInEnum

Returns the total number of the parent’s children.

Output argument.

Return Value

Returns a count of the members that are returned by this method.

Example

The following subroutine takes the name of a parent entity and the number that gets passed to the lMaxMembers argument, and prints out the labels of the child entities returned in each call to EnumChildren. The example shows how to use the lStartingIndex and lMaxMembers arguments.

Sub getChildEntityLabels(sPar, lNum)
Dim lIndex, lNumReturned, vaIDs, vaLabels, vaDescs
Dim vaNumChildren, lTotalEnum, cHFMMetadata, cHFMEntities
Dim cHFMDimension, lCounter
'g_cHFMSession is an HFMwSession object reference
Set cHFMMetadata = g_cHFMSession.metadata
Set cHFMEntities = cHFMMetadata.entities
Set cHFMDimension = cHFMEntities.dimension
lCounter = 0
lIndex = 0
Do
  lNumReturned = cHFMDimension.EnumChildren(CLng(-1), _ 
  CLng(-1), CLng(-1), sPar, lIndex, lNum, _ 
  WEBOM_METADATA_INFO_LABEL, vaIDs, vaLabels, vaDescs, _ 
  vaNumChildren, lTotalEnum)
  If (lNumReturned > 0) Then
    ' Print an <h1> that shows the ordinal #s of the entities
    ' within the set of child entities
    Response.Write "<h1>Child Entities # " & lCounter + 1 & _ 
    " through # " & lCounter + lNumReturned  & "</h1>"
    For i = 0 to uBound(vaLabels)
      Response.Write "<p>" & vaLabels(i) & "</p>"
    Next
    ' Increment the index for the lStartingIndex argument
    lIndex = lIndex + lNum
  End If
  ' lCounter counts the number of items that have been
  ' returned by the calls to EnumChildren.
  lCounter = lCounter + lNumReturned
  ' If the # of child entities returned is less than the number
  ' passed to the lMaxMembers argument, then all the children
  ' have been enumerated, so exit the loop
  If lNum = 0 Or lNumReturned < lNum then Exit Do
Loop
End Sub