Step 2 Create WAM iiiUseListRowWeblet

LANSA WAM

Step 2. Create WAM iiiUseListRowWeblet

WAM090 - Using a List Row Weblet

1.  Create a new WAM:

     Name: iiiUseListRowWeblet

     Description: Using a List Row Weblet

     Layout Weblet: iiilay01

2.  Add the following definitions after the Begin_Com:

Define Field(#fulladdr) Reffld(#std_textl)
Define Field(#location) Reffld(#std_textl)
Define Field(#DESC1) Reffld(#std_desc) Default('''Name: ''')
Define Field(#DESC2) Reffld(#std_desc) Default('''Location: ''')
Define Field(#DESC3) Reffld(#std_desc) Default('''Address: ''')
Define Field(#DESC4) Reffld(#std_desc) Default('''Start Date: ''')
Define Field(#DESC5) Reffld(#std_desc) Default('''Monthly Salary: ''')
Define Field(#DESC6) Reffld(#std_desc) Default('''Annual Salary: ''')
Define Field(#DESC7) Reffld(#std_desc) Default('''Employee Number: ''')
*
Group_By Name(#empdata) Fields(#empno #SURNAME #GIVENAME #ADDRESS1 #ADDRESS2 #ADDRESS3 #POSTCODE #DEPTMENT #SECTION #SALARY #mnthsal #STARTDTE)
Def_List Name(#emplist) Fields(#empno #fullname #fulladdr #location #SALARY #mnthsal #STARTDTE #std_textl #DESC1 #DESC2 #DESC3 #DESC4 #DESC5 #DESC6 #DESC7) Type(*Working)
*
Web_Map For(*both) Fields((#stdrentry *hidden))
WebRoutine Name(list)
Web_Map For(*both) Fields(#deptment) /* comment */
Web_Map For(*output) Fields((#emplist *private))
Case (#stdrentry)
When (= S) /* Build list of employees */
Clr_List Named(#emplist)
Select Fields(#empdata) From_File(pslmst1) With_Key(#deptment) Nbr_Keys(*compute)
Fetch Fields(#deptdesc) From_File(deptab) With_Key(#deptment) Keep_Last(15)
Fetch Fields(#secdesc) From_File(sectab) With_Key(#deptment #section) Keep_Last(10)
#std_textl := 'PHOTOS/' + #EMPNO + '.jpg'
#fullname := #givename + ', ' + #surname
#fulladdr := #address1 + ', ' + #address2 + ', ' + #address3 + ', ' + #postcode.asstring
#location := #deptdesc + ', ' + #secdesc
Add_Entry To_List(#emplist)
Endselect
Otherwise
Message Msgtxt('Enter a department code and Search')
Endcase
Endroutine

3.  Review the supplied code.

     The only unusual part of this WAM is that it defines a number of work fields used to define the labels required for the fields to be output in each row.

        The working list EMPLIST contains the required fields for each employee, selected from the logical file PSLMST1 with a key of DEPTMENT.

4.  Compile the WAM.