mardi 13 mars 2007

Assigning search parameters via Parameter property of IRSearchCriteria interface

Detail
A customization specialist might have to assign more that one search parameter via Client Script or in an AppServer Rule using the Parameter property of the IRSearchCriteria interface.

Is there a code sample on how to do this available?

Resolution
The following code sample loads the search criteria for an Active Search, which contains two open parameters e.g. “Company Name starts with ? or ?”.
It also assigns two values to the two search parameters.

Set oSearch = UIMaster.RSysClient.GetSearch("Company Name starts with ? or ?").CreateSearchCriteria
oSearch.Parameter = “ABC” ‘set first parameter
oSearch.Parameter = “XYZ” ‘set second parameter


Please note that when assigning values to more than one search parameter via a Client Script or in an AppServer Rule is it not necessary to index the parameter.
The “Parameter” property of the IRSearchCriteria interface is a Write-only property and calling it the first time will pass the first parameter, calling a second time with pass the second parameter and so on.

The following code sample will therefore FAIL and it NOT to be used:

Set oSearch = UIMaster.RSysClient.GetSearch("Company Name starts with ? or ?").CreateSearchCriteria
oSearch.Parameter(0) = “ABC” ‘set first parameter
oSearch.Parameter(1) = “XYZ” ‘set second parameter

Aucun commentaire: