FindMatchingMembersFromHierarchy

Returns the member IDs of the members with labels that match a search string.

Syntax

<IHsvTreeInfo>.FindMatchingMembersFromHierarchy bstrSearchText, lTopMemberID, varbExactMatch, pvaravaralPaths

Argument

Description

bstrSearchText

String (ByVal). The search string. Pass all or part of the labels of the members for which the search is being conducted.

If you pass a partial label, the method searches for all members that begin with the passed string.

lTopMemberID

Long (ByVal). The member ID of the top member in the hierarchy from which to begin searching. To search the entire dimension hierarchy, use the HFMConstants type library constant TREE_ROOT.

varbExactMatch

Boolean (ByVal). Specifies whether to search for an exact or partial match. Pass TRUE for an exact match search, FALSE for a partial match search.

pvaravaralPaths

Variant. Returns an array of arrays containing the member IDs of the matching members. Each array contains one item for each member in the path from the specified top member to the matching member.

For example, suppose that a search returns two members: Canada (with no parent) and UnitedStates.California. The indexes to the array of arrays would be similar to those in the following list:

  • (0)(0) = UnitedStates

  • (0)(1) = California

  • (1)(0) = Canada

Example

The following subroutine prints to Visual Basic’s Immediate window the labels of all members of a given dimension with labels that partially match the specified string.

Sub printPartMatchingLabels(iDim As Integer, sSearch As String)
Dim cTreeInfo As IHsvTreeInfo, vaMems, sLabel As String
'Set the IHsvTreeInfo interface to the specified dimension.
'g_cMetadata is an HsvMetadata object reference.
Set cTreeInfo = g_cMetadata.Dimension(iDim)
cTreeInfo.FindMatchingMembersFromHierarchy sSearch, TREE_ROOT, False, _
   vaMems
'Loop through the array of arrays
For i = LBound(vaMems) To UBound(vaMems)
  'Loop through the items in each array
  For j = LBound(vaMems(i)) To UBound(vaMems(i))
        cTreeInfo.GetLabel vaMems(i)(j), sLabel
        Debug.Print sLabel
  Next j
  Debug.Print vbCrLf
Next i
End Sub