Step 4. Code iiiFN10 Client Wrapper Function
INT009 – Department & Employee Client (Optional)
In this step, you will create the RDML (not RDMLX) wrapper function for your client. This will allow you to interact with your server from a simple Windows program.
1. Create a new LANSA process named iiiPRO07 JSM XML Employees Client, where iii is your unique 3 characters. (If the process already exists, select a different set of characters for iii.).
2. Create a new function named iiiFN10 Display Department & Employee Client belonging to process iiiPRO07. Do not create the function from a template. Do not make it an RDMLX enabled function.
3. The basic structure of this program accepts Department Codes input from the user, calls RDMLX function iiiFN09 and then displays the resulting employees list. You will need a browselist and a working list to hold this data.
a. Define WL_EMPSKL as a working list of FULLNAME and SKILDESC.
b. Define BL_EMPSKL as a browselist of FULLNAME and SKILDESC.
4. Code the input, function call, and output of the display function.
a. Insert BEGIN_LOOP and END_LOOP commands.
b. Inside the loop, insert a REQUEST command to request DEPTMENT and display the browse list BL_EMPSKL.
c. Clear both the working and browse list.
d. Exchange field DEPTMENT.
e. Call function iiiFN09, passing the working list WL_EMPSKL (to allow the populated data to return).
f. Loop through the working list, adding entries to the browselist on each iteration.
Your finished code should look something like this:
FUNCTION OPTIONS(*DIRECT)
DEF_LIST NAME(#WL_EMPSKL) FIELDS(#FULLNAME #SKILDESC) TYPE(*WORKING) ENTRYS(9999)
DEF_LIST NAME(#BL_EMPSKL) FIELDS(#FULLNAME #SKILDESC) ENTRYS(9999)
BEGIN_LOOP
REQUEST FIELDS(#DEPTMENT) BROWSELIST(#BL_EMPSKL)
CLR_LIST NAMED(#WL_EMPSKL)
CLR_LIST NAMED(#BL_EMPSKL)
EXCHANGE FIELDS(#DEPTMENT)
CALL PROCESS(*DIRECT) FUNCTION(IIIFN09) PASS_LST(#WL_EMPSKL)
SELECTLIST NAMED(#WL_EMPSKL)
ADD_ENTRY TO_LIST(#BL_EMPSKL)
ENDSELECT
END_LOOP
5. Save, compile and close the function.