Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Frequent Visitor.

How to filter my searched TRIM records?

This is my first post and am very new to this. I have an older MS Access database (which I am upgrading to MS 2016). It had some searching functions for the HP Content Manager (TRM). It was developed in VBA and now I wish to do a slight modification to it mainly a simple search using a filter.

The VBA can do string searches but what I am after is a filter to the Folder and Sub-folder level (not the document levels). The current command to do a search is objSearch.AddTitleWordClause(Trim(search_string)) and this works well but displays everything. I simply want to filter it down. How can I do this? any help appreciated.



Ps This is the code

Public Function Search_Trim_Database(search_string As String, trimtype As Integer) As Boolean
    Dim hwnd As Long
    Dim colDBs As New TRIMSDK.Databases
    Set objTRIM = New TRIMSDK.Database
    Search_Trim_Database = False
    objTRIM.ID = Trim_Database_ID   ' note dataset is Trim.ID = XX
    Set objSearch = objTRIM.NewRecordSearch
    Select Case (trimtype)
        Case 1:             Call objSearch.AddTitleWordClause(Trim(search_string))              'For Words in titles           
        Case 2:            Call objSearch.AddRecordNumberClause(Trim(search_string))           'For Record Number
        Case 3:             Call objSearch.AddDateCreatedClause(#1/1/2008#, Date)               'For Date 
        Case Else:
           ' Set objSearch = objTRIM.NewRecordSearch
            Call objSearch.EditQueryUI(hwnd)
    End Select

    Set colRecords = objSearch.GetRecords                                     ' Do the search in trim
    If IsNull(colRecords) Or colRecords.Count < 1 Then  'if no records found disconnect and get out
        MsgBox "No records found."
        Search_Trim_Database = False
        Exit Function
    End If
    Call colRecords.DisplayUI(hwnd)                                         'browse the results
    Search_Trim_Database = True

    'destroy objects
    If objTRIM.IsConnected = True Then objTRIM.Disconnect       'disconnection
    If Not objSearch Is Nothing Then Set objSearch = Nothing
    If Not colRecords Is Nothing Then Set colRecords = Nothing
    If Not objTRIM Is Nothing Then Set objTRIM = Nothing

End Function

Tags (1)
1 Reply
Micro Focus Expert
Micro Focus Expert

Re: How to filter my searched TRIM records?

I have not used the COM SDK for a long time so I forget the specifics but assuming you want to filter based on which folder the Records are contained in then you want to use a RecordContainer clause.


I assume RecordSearch has a method that will allow you to do this? If it is a relatively recent version you can use the string search in which case you use 'recContainer: [Container Uri]'.

Blog | Samples | HPE CM 9.3 SDK Docs
**Any opinions expressed in this forum are my own personal opinion and should not be interpreted as an official statement on behalf of MicroFocus**
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.