FindMatchingMembersFromHierarchyWildCard

Returns the member IDs of the members with labels or descriptions that match a search string; the search string can include wildcard characters. Description searches are for descriptions in a given language.

Syntax

<IHsvTreeInfo>.FindMatchingMembersFromHierarchyWildCard bstrSearchText, lTopMemberID, lLanguageID, pvaravaralPaths

Argument

Description

bstrSearchText

String (ByVal). String (ByVal). The search string. You can use asterisks ( * ) as wildcard characters. The following list describes the rules for wildcard searching:

  • You can use a wildcard at the beginning of the search string.

  • You can use a wildcard at the end of the search string.

  • You can use wildcards at both the beginning and end of the search string.

    Note:

    Asterisks placed anywhere other than the beginning or end are treated as literal characters, not as wildcards.

  • You can omit wildcards to perform an exact match search.

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.

lLanguageID

Long (ByVal). Specifies whether to search labels or descriptions. For description searches, this argument also specifies the language of the descriptions to be searched. Pass one of the following values:

  • To search for labels, pass the HFMConstants type library constant HFM_NO_LANGUAGE.

  • To search for descriptions, pass the ID of the language in which to search. You can get this ID with the EnumLanguages method of the HsvMetadata object.

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 match the specified string.

Sub printWildMatchingLabels(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.FindMatchingMembersFromHierarchyWildCard sSearch, TREE_ROOT, _
  HFM_NO_LANGUAGE, 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