Step 2 Create New Functions
From LANSA Web Functions
Step 2. Create New Functions
In this step, you will create two new functions with the code you have designed from the previous step.
1. Create a new LANSA process named iiiPROC03 WEBEVENT Functions, where iii are your initials. (If the process already exists, select a different set of characters for iii.)
2. Enable your iiiPROC03 process for web. If you need to know how, refer to Web Enabling a LANSA Process.
3. Working with your iiiPROC03 process, create a new function named iiiFN5 Request Department for Search. You will manually enter the code for the function.
The RDML code in the function might appear something like this:
FUNCTION OPTIONS(*DIRECT *WEBEVENT)
CHANGE FIELD(#DEPTMENT) TO(*DEFAULT)
REQUEST FIELDS(#DEPTMENT) DESIGN(*DOWN) IDENTIFY(*DESC) MENU_KEY(*NO) EXIT_KEY(*NO) USER_KEYS((01 SEARCH))
4. Working with your iiiPROC03 process, create a new function named iiiFN6 Display Department/Section. You will manually enter the code for the function. (TIP: You could start this new function by copying code from your iiiFN0 function.)
The RDML code in the function might appear something like this:
FUNCTION OPTIONS(*DIRECT *WEBEVENT)
GROUP_BY NAME(#HEADER) FIELDS(#DEPTMENT #DEPTDESC)
DEF_LIST NAME(#iiiLIST) FIELDS((#LISTDUMMY *HIDDEN) #SECTION #SECDESC #SECPHBUS)
CLR_LIST NAMED(#iiiLIST)
********** COMMENT(Fetch file DEPTAB details)
FETCH FIELDS(#HEADER) FROM_FILE(DEPTAB) WITH_KEY(#DEPTMENT) NOT_FOUND(R10) ISSUE_MSG(*YES)
********** COMMENT(Select the SECTAB file details)
SELECT FIELDS(#iiiLIST) FROM_FILE(SECTAB) WITH_KEY(#DEPTMENT)
ADD_ENTRY TO_LIST(#iiiLIST)
ENDSELECT
********** COMMENT(Display results to the user)
R10: DISPLAY FIELDS(#HEADER) DESIGN(*DOWN) IDENTIFY(*DESC) BROWSELIST(#iiiLIST) MENU_KEY(*NO) EXIT_KEY(*NO) USER_KEYS((01 RETURN))
5. Compile the new functions.