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
WebRoutine Name(ReentryTest) Desc('Test WAM')
Endroutine 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'
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