Step 1. Select Multiple Entries
FRM075 - Using a Working List
1. Create a iiiUseWrkList – Using a Working List and make the form RDMLX enabled.
2. From the tab, drop a onto the form and resize it. Change the property to EMPLOYS.
3. Drop a onto the form. It will attach to the bottom of the form. Your form should look like the following:
4. On the tab, locate the file PSLMST and expand its definition. Drag and drop the fields EMPNO, SURNAME, GIVENAME and SALARY into the list.
Change the column headings as follows:
|
Field / column |
Property |
Value |
|
EMPNO |
Caption |
Code |
|
CaptionType |
Caption | |
|
SURNAME |
Caption |
Surname |
|
CaptionType |
Caption | |
|
GIVENAME |
Caption |
Given Name |
|
CaptionType |
Caption | |
|
SALARY |
Caption |
Salary |
|
|
CaptionType |
Caption |
Resize the fields to display their content. Your should look like the following:
5. Create an event for the list view EMPLOYS.
Hint: You can create a click event by selecting EMPLOYS. On the tab, select the tab and double click on event. Alternatively, use the right mouse menu on the list view EMPLOYS and use the option to create an event routine.
6. Add code to the event routine, to clear the list EMPLOYS and read all employee records, adding entries to EMPLOYS. Your code should look like the following:
Evtroutine Handling(#EMPLOYS.Initialize) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
Clr_List Named(#EMPLOYS)
Select Fields(#EMPLOYS) From_File(pslmst)
Add_Entry To_List(#EMPLOYS)
Endselect
Endroutine
7. Create a field in the called iiiTOTSAL. Define it as Packed (15,2) field and give it an edit mask of J ( a format of 1,234,567.89-).
8. Drop the field iiiTOTSAL onto the bottom right hand side of your form. Change its to Top.

9. Select the EMPLOYS list view. On the tab, notice that the has a default of Multiple.
10. Create an event routine for list view EMPLOYS. Add code to add SALARY to iiiTOTSAL.
11. Create an event routine for list view EMPLOYS. Add code to subtract SALARY from iiiTOTSAL. Your code should look like the following:
Evtroutine Handling(#EMPLOYS.ItemGotSelection) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
#IIITOTSAL += #salary
Endroutine
Evtroutine Handling(#EMPLOYS.ItemLostSelection) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
#IIITOTSAL -= #salary
Endroutine
In an RDML form you could have used:
Change Field(#IIITOTSAL) To('#iiitotsal + #salary')
12. Compile and test your form. Select multiple entries in the (hold down the key). Total Salary should show the correct total for selected employees.
