Step 8 Build Function iiiFN12 Employee Details

LANSA Web Functions

Step 8. Build Function iiiFN12 Employee Details

In this step, you will build the Employee Details function, iiiFN12.  This function will receive the employee number (EMPNO) from the calling function by using the funcparms passed in the URL.  It will then display the Employee details.

1.  Working with your iiiPROC03 process, create a new function named iiiFN12 Employee Details. You will manually enter the code for the function.

2.  Write the RDML code to fetch the employee's data from the PSLMST file based on the value of EMPNO, which is a parameter passed to the function.

     Include a GROUP_BY statement so that the iiiLOGIN field is defined in the function.

     (This example does not include any field/file level validation.  You could include validation routines inside the RDML to validate that records were found for the browse list.)

Solution:

     One possible solution to this exercise is shown below  (where iii is your course assigned ID):

FUNCTION  (*DIRECT *WEBEVENT)
*********** This Group by can be left out however your login
***********  component will not appear without it.
GROUP_BY  NAME(#LOGGROUP) FIELDS((#iiiLOGIN))
GROUP_BY  NAME(#EMPLOYEE) FIELDS((#EMPNO *OUTPUT) (#GIVENAME *OUTPUT) (#SURNAME *OUTPUT) (#ADDRESS1 *OUTPUT) (#ADDRESS2 *OUTPUT) (#ADDRESS3 *OUTPUT) (#POSTCODE *OUTPUT) (#PHONEHME *OUTPUT) (#SALARY *OUTPUT) (#DEPTMENT *OUTPUT) (#SECTION *OUTPUT) (#PHONEBUS *OUTPUT))
FETCH     FIELDS((#EMPLOYEE)) FROM_FILE(PSLMST) WITH_KEY(#EMPNO) IO_STATUS(*STATUS) IO_ERROR(*NEXT) VAL_ERROR(*NEXT)
REQUEST   FIELDS(#EMPLOYEE) EXIT_KEY(*NO) MENU_KEY(*NO)

 

  

     Notice that this RDML solution uses a REQUEST statement instead of a DISPLAY statement. This technique is used to reduce the amount of HTML generated by LANSA for the Web.

3.  Exit and save your RDML function.

4.  Compile your RDML function iiiPROC03/iiiFN12.