Step 7. Add the RDMLX for the second WebRoutine
WAM010 - Using WEB_MAPs
In this step, you will create the RDMLX code for a second WebRoutine to demonstrate how data is passed between WebRoutines.
1. Immediately following the ENDROUTINE for WMdemo, insert the following RDML code to create a WebRoutine named WMdemo2:
Webroutine Name(WMdemo2) Desc('Web_Map Demo WR2')
Endroutine
2. This WebRoutine will require two outgoing fields (ADDRESS1 and POSTCODE) and four fields that are both incoming and outgoing (GIVENAME, SURNAME, EMPNO and STDRENTRY). EMPNO and STDRENTRY must be FOR(*BOTH) to support the functionality of the WebRoutine. The other four fields were arbitrarily divided to show the behavior of the WEB_MAP, but don't necessarily represent a practical use. Add the following WEB_MAP statements to the WebRoutine:
Web_Map For(*BOTH) Fields((#empno *output) #givename #surname (#stdrentry *hidden))
Web_Map For(*output) Fields(#Address1 #POSTCODE)
3. The logic for the FETCH the record from the Personnel Master when the STDRENTRY value is 'R'.
button will be the same as in WMdemo, that is, it willIf Cond(#stdrentry = R)
Fetch Fields(#empdata) From_File(pslmst) With_Key(#empno)
Endif
Your finished WebRoutine should appear as follows:
Webroutine Name(WMdemo2) Desc('Web_Map Demo WR2')
Web_Map For(*BOTH) Fields((#empno *output) #givename #surname (#stdrentry *hidden))
Web_Map For(*output) Fields(#Address1 #POSTCODE)
If Cond(#stdrentry = R)
Fetch Fields(#empdata) From_File(pslmst) With_Key(#empno)
Endif
Endroutine
4. Click the
button in the LANSA Editor toolbar to compile the WAM component.