Step 4. Display Details for Sections and Employees
In this step you will complete the WAM by adding WebRoutines to display details for sections and employees.
1. Define a Group_by SECDATA for fields SECTION, SECDESC, SECADDR1, SECADDR2 SECADDR3, SECPCODE and SECPHBUS. All fields should have an output attribute.
2. Create a new WebRoutine SecDet, based on the following:
Your code should look like the following:
Webroutine Name(SecDet)
Web_Map For(*input) Fields(#onsubid #ancestor)
Web_Map For(*output) Fields(#secdata)
Get_Entry Number(1) From_List(#ancestor)
#deptment := #listid
#std_num := (#deptment.CurSize + 1)
#section := #onsubid.substring( #std_num )
Fetch Fields(*all) From_File(sectab) With_Key(#deptment #section)
Endroutine
3. Compile the WAM.
4. Define a Group_by EMPDATA for fields EMPNO, SURNAME, GIVENAME, ADDRESS1, ADDRESS2, ADDRESS3, POSTCODE, PHONEHME, PHONEBUS, DEPTMENT, SECTION, SALARY, STARTDTE, TERMDATE. All fields should have an output attribute.
5. Define a working list SKILLS, for fields SKILCODE, SKILDESC, GRADE, COMMENT, DATEACQ. All fields should have an output attribute.
6. Open the WebRoutine SecDet in the view. Drop the Simple blank layout onto the page.
7. Use the
menu option to give the web page the theme styles to match your common layout.8. Save your changes.
9. Create a new WebRoutine EmpDet.
Your code should look like the following:
Webroutine Name(EmpDet)
Web_Map For(*input) Fields(#onsubid #ancestor)
Web_Map For(*output) Fields(#empdata #skills)
#empno := #onsubid
Fetch Fields(#empdata) From_File(pslmst) With_Key(#empno)
Clr_List Named(#skills)
Select Fields(#skills) From_File(pslskl) With_Key(#empno)
Fetch Fields(#skildesc) From_File(skltab) With_Key(#SKILCODE)
Add_Entry To_List(#skills)
Endselect
Endroutine
10. Compile the WAM.
11. Open the EmpDet WebRoutine in the view. Drop the Simple blank layout onto the web page.
12. On the
ribbon use the button, then dialog to add the Style external resources to match those used in your common layout.13. Open the SecDet WebRoutine in the view. Drop the Simple blank layout onto the web page.
14. On the
ribbon use the button, then dialog to add the Style external resources to match those used in your common layout.15. Save your changes.
16. Test your WAM by running the DeptView WebRoutine in the browser. You should be able to expand the tree view and select a department, a section or an employee to display its details.
17. You probably found that the Navigation panel needed more space to display employee details.
a. Open the DeptView WebRoutine in the view
b. Select the table containing the tree view and Navigation panel. Do this by selecting a corner of the table. Alternatively, click anywhere inside the table and use the
tab to locate and select the table.c. Drag the right hand edge of the table to the right.
d. Drag the bottom of edge of the table down.
e. If you examine the
properties for the table you will see its current size in pixels (for example, width: 800px and height: 560px).f. You can also hover over the center border and drag this to the left to match the size of the tree view weblet.
g. If necessary adjust the size of the Navigation panel to use the space now available
h. Save your changes
i. Re-test your WAM.