Step 3. Create WAM to Display Employee Documents
WAM095 - LOB Data Types and Stream Files
1. Create a new WAM:
Name: iiiDspEmpDocs
Description: Display Employee Documents
Layout Weblet: iiilay01
2. Define your WAM based on the following logic:
- Map field STDRENTRY for *both as a *hidden field
- Define a Group_by, EMPDATA for fields EMPNO, SURNAME, GIVENAME, ADDRESS1, ADDRESS2, ADDRESS3, POSTCODE, DEPTMENT and SECTION.
- Define a working list DOCLIST, containing fields DF_ELFNAM and PRIFILRRN.
PRIFILRRN should be a hidden field.
- Define a WebRoutine BEGIN
|
- Clear list DOCLIST - Fetch fields for group_by EMPDATA from file PSLMST with the key EMPNO - FULLNAME = GIVENAME + ', ' + SURNAME - Select field DF_ELFNAM from the file DXDOCS with the key 'DEM_ORG_SEC_EMP', DEPTMENT, SECTION, EMPNO and return relative record number to PRIFILRRN Add entry to DOCLIST - End of select |
- End of routine
- Define a WebRoutine SEND_DOCUMENT with a Response keyword of #HTTPR
- Map for *input field PRIFILRRN
- Fetch field DX_ELBLOB from the file DXDOCS with the relative record number PRIFILRRN.
- Set #HTTPR property ContentFile to #DXELBLOB.FileName
- End of routine
Note: The field DX_ELBLOB returns the file into a local temporary directory, using an 8.3 filename. For example:
C:\DOCUME~1\pcuser\LOCALS~1\Temp\lobuser\pcuser\5152\dxdocs\dx_elblob\contract.pdfThis path may be defined by the LPTH=directory run time parameter. If the LPTH parameter is not defined, the path used will be the TPTH setting. The default value for this path is the user's temporary path, for example: C:\Users\John\AppData\Local\Temp
This can be quickly found using %temp% in the Explorer address bar.
For further information, refer to the Standard X_RUN Parameters in the .
3. Compile iiiDspEmpDocs and open the WebRoutine BEGIN in the view. It should look like the following:
4. Drop a
weblet alongside the employee number field.Set up the push button properties:
|
5. Save your changes.
6. Select the column heading "Document long file" and delete it.
Type in a new the column heading "Employee Documents".
You may need to click somewhere else in the layout, to refresh the column heading with your changes.
7. Save your changes.
Your design should look like the following:
8. Drop an
weblet into the file name column of the list (the left hand column). Ignore the increase in width of this column. At run time it will display with the width of the actual file names.Set up the
weblet properties:
|
Save your changes.
9. Execute and test your WAM in the browser.
a. Enter employee number A0070 and select the
push button. Your web page should look like the following:
b. Select one of the documents shown in the list. The document should be displayed in a new browser window.
Continue at Step 4. Enhance Appearance of the Documents List (Optional)