The LoadCollection method of the TitleMatch object is called when the reviewer clicks Find in the Choose Title dialog box. The method creates a collection of title, author, and critique information that is loaded into the ListView control of the extended Choose Library Title dialog box.
First, the LoadCollection method, a Friend subroutine, calls the AdvancedSearch method of the Search component passing four parameters:
The DataSpace object is used because this is a client-side component. The RDS.DataSpace object creates client-side proxies to custom business objects located on the business-services tier. Remote Data Service (RDS) uses the RDS.DataSpace object's CreateObject method to create business object proxies. The business object proxy is dynamically created whenever an instance of its middle-tier business object counterpart is created.
Set RDS = CreateObject("RDS.DataSpace")
RDS.InternetTimeout = 30
Set Search = RDS.CreateObject("CML.Search", "http://" & ServerName)
Set rs = Search.AdvancedSearch(TitleKeywords, AuthorKeywords, MediaTypes, Logon)
Before you can instantiate a customized component in the middle tier using the RDS.DataSpace object, you need to register it under the ADCLaunch registry key. For more information, see Enabling CML.Search for Launch.
Note In the preceding code, the Search object is instantiated through the RDS DataSpace object in the following command:
Set Search = RDS.CreateObject("CML.Search", "http://" & ServerName)
The second parameter in this line specifies that HTTP is the protocol used to communicate with the Web server. HTTP is a stateless protocol. Alternatively, DCOM (a protocol with state) could be used to instantiate the Search object, with the following syntax:
Set Search = CreateObject("CML.Search", "\\" & ServerName)
Next, items are added to the m_items collection. An instance of the FoundTitle object, named Item, is instantiated for each record in the rs recordset. Each field in the record is assigned to a property of the Item object and each instance of the Item object is added to an m_items collection. The Boolean value returned in the isApproved field of the recordset is translated into the ReviewStatus property of the Item object.
' Set item properties from current record
Item.BibNo = rs("bib#")
Item.Title = rs("title")
Item.Authors = rs("authors")
Item.MediaType = rs("coll")
Item.Published = rs("pubdate")
Item.ObjectID = rs("objectid")
The complete code for the LoadTitle method is available in TitleMatch.cls in the code section.