Follow this step if you did not set up documents for an employee using the demonstration VLF application, in the file DXDOCS.
This WAM will display a fixed list of documents for an employee, based on a data from a supplied text file. To simplify building the list of documents, the WAM reads a text file MYDOCS.txt to populate a working list. Another working list is populated for display. A later step will add another column to this list which will contain a clickable image.
1. Create a new WAM:
Name: iiiDspEmpDocs
Description: Display Employee Documents
Layout Weblet: iiilay01
2. Create your WAM based on the following logic:
3. Define a WebRoutine SEND_DOCUMENT with a Response keyword of #HTTPR
Sample code is supplied in WAM095. Appendix B.
4. Compile your WAM. Open the WebRoutine BEGIN in the Design view, it should look like the following:
5. Drop a Push Button weblet alongside the employee number field.
Set up the push button properties:
|
6. Save your changes.
7. Select the column heading "Document long file" and delete it.
Type in a new column heading - Employee Documents.
You may need to click on another part of the layout to refresh the column heading.
8. Drop an Anchor weblet into the list's file name column. Ignore the increase in width of the column. At run time it will be displayed with the width of the actual file names.
Set up the Anchor weblet properties:
|
Your design should look like the following:
9. Save your changes.
10. Execute your WAM in the browser. Any employee number may be entered (A0070, A0090, A1234 etc). The WAM will always display the employee details and a fixed list of documents.
Click on one of the documents to display it. The way that the browser and Windows handles the request will depend on the version of browser and the version of Windows being used. For example, in Windows 7 with MS Office installed and IE10, the txt and pdf files are displayed in a new browser tab. The Office documents prompt to be displayed in the required Office program.
Continue with Step 4. Enhance Appearance of the Documents List (Optional)