Step 7 Add the RDMLX for the second WebRoutine

LANSA WAM

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) 

  • The STDRENTRY field will be used to determine what button was pressed, and decide what logic to execute.
  • The STDRENTRY field should not be visible on the HTML page.
  • The EMPNO field should be output only, so the user cannot change it.
  • The other fields will be used to demonstrate how the WEB_MAP works.
  • 3.  The logic for the Read button will be the same as in WMdemo, that is, it will FETCH the record from the Personnel Master when the STDRENTRY value is 'R'.

    If 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 Compile button in the LANSA Editor toolbar to compile the WAM component.