2 5 Example of a WEBEVENT Function

LANSA Web Functions

2.5 Example of a WEBEVENT Function

The simple header / detail function can also be written to execute as a Web event function. If you execute the FRWEBENQ01 template, you can create a WEBEVENT function which request search information and then display the detailed results. The function created by FRWEBENQ01 is a re-entrant WEBEVENT function. For more details about re-entrant functions, refer to Handling Re-entrant Functions.

The overall structure of the RDML in the function will appear very different to the procedural example. The function will contain a REQUEST for the search data and a DISPLAY of the search results. However, the location of the processing logic is very different in the WEBEVENT function. WEBEVENT functions terminate immediately after processing a REQUEST or DISPLAY statement.

When the WEBEVENT function encounters the REQUEST statement, a page is sent to the client's browser and the function terminates. There is no need to maintain the state, as the LANSA function is no longer active.

When the user responds, the function must execute again because it has terminated. The function receives the information from the REQUEST and will select the required data to execute the DISPLAY statement. Again, once the DISPLAY is executed, the function terminates.

If the browser's Back button is used to return to the REQUEST page, there is no problem. When the user submits the REQUEST again, the function simply executes again. It receives the information from the REQUEST and will select the required data to execute the DISPLAY statement as before.

LANSA automatically handles the exchange of the data. The developer must properly code the RDML in the function knowing that a function terminates once a REQUEST or DISPLAY statement is encountered. The function is written with the processing logic always preceding the screen display.

For more detailed examples, refer to WEBEVENT Functions.

 

WEB001 - Types of LANSA Web Functions