Step 5. Complete WAM RDMLX

WAM085 - Enhancing the User Interface

1.  The begin WebRoutine will be used to start session management and transfer to the select WebRoutine. Add the following code to the begin WebRoutine:

#com_owner.sessionstatus := active
Message Msgtxt('Session is active')

Transfer Toroutine(select)
 

2.  The select WebRoutine display the employee number for input. It also supports push button to clear the saved list. Add the following code to the select WebRoutine. Ensure that you change iii to your initials.

Web_Map For(*output) Fields(#empno)
Case (#stdrentry)
When (= C)
Clr_List Named(#savlist)

Endcase
 

3.  The showpage WebRoutine displays all employee fields for input. Employee number is an output field. Work field EMPNOW is mapped as a hidden field to store current employee number.

     When initially invoked from the select WebRoutine, the employee fields are retrieved.

     When invoked from the Save push button, an entry is added to the saved list.

     Add the following code to the showpage WebRoutine. Change iii to your initials.

Web_Map For(*both) Fields((#empno *output) #surname #givename #iiidate #iiidtetme #iiinote #iiigender #iiicuremp #iiitime (#empnow *hidden) #marstat #onleave #review #termdte)
Case (#stdrentry)
* Invoked from select WebRoutine
When (= S)
#empnow := #empno
Fetch Fields(#surname #givename) From_File(pslmst) With_Key(#empno)
* Save push button
When (= U)
#empno := #empnow
Add_Entry To_List(#savlist)
Transfer Toroutine(select)
Endcase

 

4.  The showlist WebRoutine is invoked via a push button on the select web page. This routine clears the list EMPLIST and populates it from the current saved list SAVLIST. Add the following code to the showlist WebRoutine.

Web_Map For(*output) Fields(#emplist)
Clr_List Named(#emplist)
Selectlist Named(#savlist)
Add_Entry To_List(#emplist)
Endselect
 

5.  Add an event handling routine for invalid session. This will transfer to the begin WebRoutine if the WAM is invoked with an invalid or expired session status. The begin WebRoutine executes with *sessionstatus_none. Add the following event routine:

Evtroutine Handling(#com_owner.sessionInvalid)
Message Msgtxt('Session has expired')
Transfer Toroutine(begin)
Endroutine

 

6.  Compile the WAM.