Step 1 Create a New Field in the Repository

LANSA Web Functions

Step 1. Create a New Field in the Repository

To demonstrate how components are automatically embedded for a field, you must create a new field iiiDEPT (where iii are your initials) in the LANSA. The iiiDEPT field will be copied from the DEPTMENT field.

1.  From the LANSA development environment, work with the fields in the LANSA Repository. Create a new field called iiiDEPT (where iii=your ID) by copying the DEPTMENT field which already exists in the LANSA Repository.

2.  When you save the field, you may copy the help text, validation rules and multilingual definitions for the field.

3.  Edit the RDML in your iiiFN07 function. Use the find and change utility in the Web Function Editor to change all occurrences of DEPTMENT to iiiDEPT. (There should be four changes.) Your RDML might appear as follows:

FUNCTION   OPTIONS(*DIRECT *WEBEVENT)
DEFINE     FIELD(#RENTRY) TYPE(*CHAR) LENGTH(1) DEFAULT(*BLANK)
GROUP_BY   NAME(#HEADER) FIELDS((#iiiDEPT) (#DEPTDESC) (#RENTRY *HIDDEN))
DEF_LIST   NAME(#iiiLIST) FIELDS((#LISTDUMMY *HIDDEN) #SECTION #SECDESC #SECPHBUS)
IF         COND('#RENTRY *NE Y')
CHANGE     FIELD(#HEADER) TO(*DEFAULT)
CHANGE     FIELD(#RENTRY) TO(Y)
REQUEST    FIELDS((#iiiDEPT) (#RENTRY *HIDDEN)) DESIGN(*DOWN) IDENTIFY(*DESC) MENU_KEY(*NO) EXIT_KEY(*NO) USER_KEYS((01 SEARCH))
ELSE      
CLR_LIST   NAMED(#iiiLIST)
**********  COMMENT(Fetch file DEPTAB details )
FETCH      FIELDS(#HEADER) FROM_FILE(DEPTAB) WITH_KEY(#iiiDEPT) NOT_FOUND(R10) ISSUE_MSG(*YES)
**********  COMMENT(Select the SECTAB file details)
SELECT     FIELDS(#iiiLIST) FROM_FILE(SECTAB) WITH_KEY(#iiiDEPT)
ADD_ENTRY  TO_LIST(#iiiLIST)
ENDSELECT 
**********  COMMENT(Display results to the user)
R10: CHANGE     FIELD(#RENTRY) TO(*BLANK)
DISPLAY    FIELDS(#HEADER) DESIGN(*DOWN) IDENTIFY(*DESC) BROWSELIST(#iiiLIST) MENU_KEY(*NO) EXIT_KEY(*NO) USER_KEYS((01 RETURN))
ENDIF

 

4.  Save the changes to the function and exit the editor.

5.  Do NOT recompile your function. The function will be compiled once the new component has been created for iiiDEPT.