Step 5. Populate the Tab Sheets
FRM065 - Using List Components
In this step you will create an
event routine for the EMPLOYS, and fetch employee data and select holiday data.1. Add fields iiiSALARY to the Group_by EMPDATA.
2. Complete the EMPLOYS.
event routine based on the following:Fetch fields EMPDATA from the file iiiEmployees with the key iiiEmployNumber
Clear the list HOLIDAYS
Select HOLIDAYS from the file iiiEmpHolidays with the key iiiEmployNumber
Add entry to HOLIDAYS
End select
Your code should look like the following:
Evtroutine Handling(#EMPLOYS.ItemGotFocus) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
Fetch Fields(#empdata) From_File(iiiEmployees) With_Key(#IIIEMPLOYNUMBER)
Clr_List Named(#HOLIDAYS)
Select Fields(#HOLIDAYS) From_File(iiiEmpHolidays) With_Key(#IIIEMPLOYNUMBER)
Add_Entry To_List(#HOLIDAYS)
Endselect
Endroutine
3. Add code to the end of the SEARCH.Click event to clear the employee fields using the Group_By and clearing the HOLIDAYS Grid. Your code should look like:
. . . . .
#EMPDATA := *default
Clr_List #HOLIDAYS
Endroutine
4. Test your completed application. You should be able to search by one of three methods. Changing focus to an entry in list view EMPLOYS should display employee details and populate the HOLIDAYS grid.