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:

     PRIFILRRN should be a hidden field.

                   

-  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

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.pdf

This 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 X_RUN Parameter Summary in the Technical Reference Guide.

3.  Compile iiiDspEmpDocs and open the WebRoutine BEGIN in the Design view. It should look like the following:

xmage355

4.  Drop a Push Button weblet alongside the employee number field.

     Set up the push button properties:

Property

Value

Caption

Details

On_click_wrname

BEGIN

submitExtraFields

 

Field Name: STDRENTRY
Literal value: S

 

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:

SNAGHTML190dfe6

8.  Drop an Anchor 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 Anchor weblet properties:

Property

Value

Currentrowhfield

PRIFILRRN

Currentrownumval

$PRIFILRRN

On_click_wrname

SEND_DOCUMENT

Show_in_new_window

True

 

     Save your changes.

9.  Execute and test your WAM in the browser.

a.  Enter employee number A0070 and select the Details 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)