In this step, you will use the LANSA Editor to create the code for a new WebRoutine that will give you an understanding of Weblets and re-entrant programming. You will use a WEB_MAP statement to specify the fields that are passed in and out of the WebRoutine. Your initial code looks like the following:
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_WAM)
End_Com
- Immediately following the BEGIN_COM, insert the following RDMLX code to create a WebRoutine named ReentryTest:
WebRoutine Name(ReentryTest) Desc('Test WAM')
Endroutine - This WebRoutine will require three fields that are both incoming and outgoing.
- STDRENTRY will be used to control the functionality of the WebRoutine each time it is called.
- GIVENAME and SURNAME are to demonstrate the different display modes for fields on the page.
- Add the following WEB_MAP statement to the WebRoutine:
Web_Map For(*BOTH) Fields((#Givename *input) (#Surname *output) (#Stdrentry *hidden))
- The STDRENTRY field will be used to identify the execution state.
- The STDRENTRY field is qualified as hidden so as not to be visible on the page.
- The GIVENAME field will accept input.
- The SURNAME field will be output only.
- Set up a CASE loop using the field STDRENTRY to display different messages.
Case Of_Field(#Stdrentry)
When Value_Is(= A)
Message Msgtxt('Push Button was pressed')
When Value_Is(= B)
Message Msgtxt('Hyperlink was clicked')
When Value_Is(= C)
Message Msgtxt('Check Box was changed')
When Value_Is(= D)
Message Msgtxt('Radio Button was selected')
When Value_Is(= E)
Message Msgtxt('Dropdown was changed')
Otherwise
Message Msgtxt('Page loaded normally')
Endcase - Set GIVENAME and SURNAME to your name.
#Givename := 'your first name'
#Surname := 'your last name'Your finished WebRoutine should appear as follows:
Webroutine Name(ReentryTest) Desc('Test WAM')
Web_Map For(*BOTH) Fields((#Givename *input) (#Surname *output) (#Stdrentry *hidden))
Case Of_Field(#Stdrentry)
When Value_Is(= A)
Message Msgtxt('Push Button was pressed')
When Value_Is(= B)
Message Msgtxt('Hyperlink was clicked')
When Value_Is(= C)
Message Msgtxt('Check Box was changed')
When Value_Is(= D)
Message Msgtxt('Radio Button was selected')
When Value_Is(= E)
Message Msgtxt('Dropdown was changed')
Otherwise
Message Msgtxt('Page loaded normally')
Endcase
#Givename := 'your first name'
#Surname := 'your last name'
Endroutine