This step will reuse the Pop_up component iiiMessagePopUp which was created in exercise WBF025 to display error messages returned by the Server Module.
1. On the Favorites / Last Opened tab, locate the reusable part iiMessagePopUp and drag it onto the top row of the web page.
2. Use Bring Forward button, Bring to the Front option, on the Home ribbon, to bring the pop-up to the front.
a. Select the Layout ribbon and give the pop-up a margin Top of 150
b. Select the Details tab and change the pop-up Name to Messages.
3. Save your web page.
4. Add the following code to each method routine for the Fetch, Save and Delete method routines.
Changes are highlighted.
Mthroutine Name(Fetch)
Define_Com Class(#iiixDepartmentsDataServer.Find) Name(#FindDepartment)
#sys_msgq.clearall
#FindDepartment.executeasync( #xDepartmentCode #xDepartments #io$sts )
Evtroutine Handling(#FindDepartment.completed)
If (#io$sts = OK)
Else
#Messages.show
Endif
Endroutine
Endroutine
Note: Messages are returned by the Server Module into a messages collection in the component SYS_MsgQ. i.e. Sys_MsgQ.messages.
The Show method in the Messages component (iiiMessagePopUp) populates a list control, reading messages in Sys_MsgQ.messages in a FOR/ENDFOR loop.
5. Compile the iiiMaintDepartment web page.
6. Open the server module iiixDepartmentsDataServer in the editor.
7. Change the FETCH statement in the Find srvroutine to issue a message:
Fetch Fields(#xDepartments) From_File(xDepartments) With_Key(#xDepartmentCode) Issue_Msg(*YES)
In your own application you will probably add your own error message for "record not found".
8. Compile the server module iiixDepartmentsDataServer.
9. Test the web page. The messages pop-up should appear: