SearchInit
SearchInit:Component processor determines search record, search keys, search mode and displays the search page accordingly in SearchInit event. That is why we can write the code for skipping the search pge on SearchInit event.Following functions can be used in SearchInit: SetSearchEditClearSearchEditSetSearchDefaultClearSearchDefaultSetSearchDialogBehaviorThe SearchInit event is generated just before a search, add, or data-entry dialog box is displayed. SearchInit triggers associated PeopleCode in the search key fields of the search record. This allows you programmatically set values of search daialog fields. For example, if you want allow entry of search field for a user and display default values for other users you could write the belowIF (%OPRID =="USERNAME_REQ") THEN RECORDNAME.SEARCHKEY = "";ELSE RECORDNAME.SEARCHKEY = "SOMEVALUE"; GRAY(RECORDNAME.SEARCHKEY);END-IF;
SearchInit PeopleCode is performed before the search page appears.Place SearchInit PeopleCode on search key fields or alternate search key fields on a search record or component search record.Do not place errors or warnings in SearchInit.SearchInit PeopleCode can be associated with record fields and component searchrecords.You cannot use DoModal,DoModalComponent,Transfer,TransferPage within SearchInitGiven below are important functions that are used in SearchInitIf you want the SETID to default from the operator defaults table for SETID search field. Add the following PeopleCode to either the Record.Field.SearchInit or Component.Record.SearchInit PeopleCode.SetSearchDefault(RECORD.FIELD);Where RECORD.FIELD refers to the name of the record and field that you set the field default for in the first step.Use the SetSearchDialogBehavior function in SearchInit PeopleCode to set the behavior of search and add dialog boxes before a page is displayed, overriding the default behavior. There are two dialog behavior settings: skip if possible (0) and force display (1).Skip if possible means that the dialog box is skipped if all of the following are true:All required keys have been provided (either by system defaults or by PeopleCode).If this an Add dialog box, then no duplicate key error results from the provided keys; if this error occurs, the processing resets to the default behavior.If this is a Search dialog box, then at least one row is returned based on the provided keys.
Force display means that the dialog box displays even if all required keys have been provided. The default behavior of the search and add dialog boxes is force display.%Mode returns a String value consisting of an uppercase character specifying the action a user selected when starting the current component. The following values can be returned. You can check either for the string value (“A”, “U”, and so on.) or for the constant. It is generally used to check whether the user is in Add Mode or Update/Display Mode.%Mode is often used in Page Activate, SearchInit, but can be used in other peoplecode events too.Some of the other commonly used functions in search init are SetSearchEdit, ClearSearchEdit, IsSearchDialog, ClearSearchDefault.
SearchSave
SearchSave event happens when we click on search button of search page after entering the search values. We can write validations to check whether any search criteria is entered on the search page on SearchSave event. In SearchSave event itself search values appear listed in a grid on search page. If any error is issued on this event using peoplecode processing stops and no search result are listed on the page.Here is an example of a SearchSave PeopleCode event:rem No spaces allowed in User Idrem also do not allow the userid of PPLSOFTif %Mode = "A" Then&find = Find(" ", PSOPRDEFN_SRCH.OPRID);if &find > 0 ThenError MsgGet(48, 54, "Message not found.");End-If;if Upper(PSOPRDEFN_SRCH.OPRID = "PPLSOFT" ThenError MsgGet(48, 235, "Message not found.");End-If;End-If;
SearchSave PeopleCode is performed after the user clicks the Search button or the Add button on the search page.Place SearchSave PeopleCode on search key fields or alternate search key fields on a search record or component search record.Use SearchSave to validate values entered in the search page fields.
SearchInit:Component processor determines search record, search keys, search mode and displays the search page accordingly in SearchInit event. That is why we can write the code for skipping the search pge on SearchInit event.Following functions can be used in SearchInit: SetSearchEditClearSearchEditSetSearchDefaultClearSearchDefaultSetSearchDialogBehaviorThe SearchInit event is generated just before a search, add, or data-entry dialog box is displayed. SearchInit triggers associated PeopleCode in the search key fields of the search record. This allows you programmatically set values of search daialog fields. For example, if you want allow entry of search field for a user and display default values for other users you could write the belowIF (%OPRID =="USERNAME_REQ") THEN RECORDNAME.SEARCHKEY = "";ELSE RECORDNAME.SEARCHKEY = "SOMEVALUE"; GRAY(RECORDNAME.SEARCHKEY);END-IF;
SearchInit PeopleCode is performed before the search page appears.Place SearchInit PeopleCode on search key fields or alternate search key fields on a search record or component search record.Do not place errors or warnings in SearchInit.SearchInit PeopleCode can be associated with record fields and component searchrecords.You cannot use DoModal,DoModalComponent,Transfer,TransferPage within SearchInitGiven below are important functions that are used in SearchInitIf you want the SETID to default from the operator defaults table for SETID search field. Add the following PeopleCode to either the Record.Field.SearchInit or Component.Record.SearchInit PeopleCode.SetSearchDefault(RECORD.FIELD);Where RECORD.FIELD refers to the name of the record and field that you set the field default for in the first step.Use the SetSearchDialogBehavior function in SearchInit PeopleCode to set the behavior of search and add dialog boxes before a page is displayed, overriding the default behavior. There are two dialog behavior settings: skip if possible (0) and force display (1).Skip if possible means that the dialog box is skipped if all of the following are true:All required keys have been provided (either by system defaults or by PeopleCode).If this an Add dialog box, then no duplicate key error results from the provided keys; if this error occurs, the processing resets to the default behavior.If this is a Search dialog box, then at least one row is returned based on the provided keys.
Force display means that the dialog box displays even if all required keys have been provided. The default behavior of the search and add dialog boxes is force display.%Mode returns a String value consisting of an uppercase character specifying the action a user selected when starting the current component. The following values can be returned. You can check either for the string value (“A”, “U”, and so on.) or for the constant. It is generally used to check whether the user is in Add Mode or Update/Display Mode.%Mode is often used in Page Activate, SearchInit, but can be used in other peoplecode events too.Some of the other commonly used functions in search init are SetSearchEdit, ClearSearchEdit, IsSearchDialog, ClearSearchDefault.
SearchSave
SearchSave event happens when we click on search button of search page after entering the search values. We can write validations to check whether any search criteria is entered on the search page on SearchSave event. In SearchSave event itself search values appear listed in a grid on search page. If any error is issued on this event using peoplecode processing stops and no search result are listed on the page.Here is an example of a SearchSave PeopleCode event:rem No spaces allowed in User Idrem also do not allow the userid of PPLSOFTif %Mode = "A" Then&find = Find(" ", PSOPRDEFN_SRCH.OPRID);if &find > 0 ThenError MsgGet(48, 54, "Message not found.");End-If;if Upper(PSOPRDEFN_SRCH.OPRID = "PPLSOFT" ThenError MsgGet(48, 235, "Message not found.");End-If;End-If;
SearchSave PeopleCode is performed after the user clicks the Search button or the Add button on the search page.Place SearchSave PeopleCode on search key fields or alternate search key fields on a search record or component search record.Use SearchSave to validate values entered in the search page fields.
No comments:
Post a Comment