Returns the member IDs of those members of a member list with labels that match a search string. Each time a member matching the search criteria is found, the member ID of the member and the member ID of its parent are returned.
The pbFoundMatch argument returns a Boolean that indicates the success of the find operation, thus allowing you to loop until all occurrences are found, as shown in the example.
<IHsvTreeInfo>.Find lListID, lTopMemberID, bstrSearchText, bForward, plPos, plMemberID, plParentID, pbFoundMatch
Long (ByVal). Identifies either the default dimension hierarchy or a member list. Pass the HFMConstants type library constant MEMBER_LIST_ALL_HIERARCHY to search the default hierarchy, or a valid list ID to search a member list. You can get member list IDs with GetMemberListID. | |
Long (ByVal). The usage of this argument depends on what you pass to the lListID argument:
| |
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, Find will search for all members that begin with the passed string. | |
Boolean (ByVal). Indicates whether the search will go forwards or backwards in the dimension hierarchy or member list. Pass TRUE to search forwards, FALSE to search backwards. | |
Long. Sets the starting position of the search within the dimension hierarchy or member list, and returns a number that should be passed to the next call to Find. Use this argument as follows: | |
Long. If a member label is found that matches the search string, this argument returns the member ID of the member. | |
Long. If a member label is found that matches the search string, this argument returns the member ID of the member’s parent. | |
Boolean. Returns TRUE if a member label is found that matches the search string, otherwise FALSE. |
The following subroutine prints to Visual Basic’s Immediate window the labels of all members of a given dimension and member list that partially match the specified string. The example also prints labels of parent members.
Sub printListMatch(iDim As Integer, lListId As Long, _ sDesc As String) Dim lPos As Long, cTreeInfo As IHsvTreeInfo, lMem As Long Dim lPar As Long, bRet As Boolean, sMemLabel As String Dim sParLabel As String 'g_cMetadata is an HsvMetadata object reference Set cTreeInfo = g_cMetadata.Dimension(iDim) lPos = -1 bRet = True Do cTreeInfo.Find lListId, TREE_ROOT, sDesc, True, lPos, _ lMem, lPar, bRet If bRet = True Then cTreeInfo.GetLabel lMem, sMemLabel cTreeInfo.GetLabel lPar, sParLabel Debug.Print sMemLabel & " " & sParLabel End If Loop Until bRet = False End Sub