Monday, July 27, 2009

Auto-Displaying Search page results

What do you do if the customer comes up to you and says that they find clicking the 'Search' button on the search page cumbersome and would 'love' to have the search results defaulted when the search page loads.
This is where the SetSearchDialogBehaviour function will come to your rescue. Assign wildcard values to your search fields and call the SetSearchDialog behaviour function. This function is normally used in the context of skipping the search page. Theoretically, if a complete value is provided for all search keys before calling the SetSearchDialog behaviour function, then the search page will be skipped and the users will be taken directly into the transaction page. But the actual idea behind the function is that it will auto-trigger the search functionality. So naturally when just a wild card value is given to the search fields and the function invoked, then all the search results will be displayed. For example, if EMPLID is the only search field, the following code can be written to popualte the search results automatically on loading the search page.

/*Write this code in SearchInit.*/
REC.EMPLID.value = '%';
SetSearchDialogBehaviour(0);

1 comment:

Mani S said...

Very useful.. thanks a ton!