Step 1. Install Required Documents
In this exercise you will need some files from the zip file described in Before you Begin at the beginning of WAM チュートリアル (英語).
1. You will need the following files to complete this exercise:
- V_Brown_CV.pdf
- Employee_Confidentiality_Agreement.pdf
- A0070_Details.doc
- A0070_Holidays_2013.xls
- A0070_Notes.txt
- A0070_Presentation.ppt
- MYDOCS.txt
The file MYDOCS.txt contains a list of the files to be displayed, which will be read by your WAM if you are not using the VLF application to store images in file DXDOCS.
Copy these files from the Extra Files to the folder: C:\Program Files (x86)\LANSA\
IBM i
a. If you are running your WAMs on the IBM i, copy the file MYDOCS.txt into an IFS folder such as /LANSA_d13pgmlib/ where d13pgmlib is your LANSA program library.
b. Copy all other above files into the IFS folder, such as:
LANSA_d13pgmlib/webserver/images/
c. Change your RDML code to use the first path to TRANSFORM_FILE, and the second path to retrieve the files to send to the web server.
WAM095. Appendix A contains sample code for both Windows and IBM i execution.
Alternatively, use any files that you have available that will be recognized by windows and can be opened in the browser. Note, that in this case you will need to create a simple text file MYDOCS.txt containing a list of the files you wish to display.
2. A later step requires a set of small gif images for each file type, which will be displayed as a clickable image in the first column of the employee documents list.
Windows
These files are supplied in the Extra Files zip file. Copy the files from the File_GIFS folder to to:
c:\Program Files (x86)\LANSA\WebServer\Images
doc.gif htm.gif html.gif |
pdf.gif ppt.gif text.gif |
txt.gif xls.gif |
IBM i
If you are running your WAM on the IBM i, copy the above gif files to the IFS for example to:
/LANSA_d13pgmlib/webserver/images/ where d13pgmlib is the name of your program library.
Scenario
This exercise may be completed in two ways:
1. Setting up documents for an employee in the file DXDOCS using the demonstration Visual Frameworks application. Continue immediately below to follow this approach
2. Reading an employee record and setting up a working list containing the names of images associated with the selected employee. To follow this approach, go directly to Step 3a. Create WAM to Display Employee Documents.
The following assumes that you have Visual Frameworks (VLF) installed in the partition being used for the WAM training tutorials.
The file DXDOCS is maintained by the Documents command handler in the shipped VLF HR Demo Application for the business object, Resources.
You will use this application to set up documents for at least one employee. Your WAM will then enable these documents to be displayed in the browser.
If you are testing your WAM applications locally (on your development PC), you can start the Visual Framework and work offline. You will be updating the DXDOCS file locally.
If you are creating WAM applications to run on an IBM i server, your Visual Framework must be configured to logon to the IBM i server. Your documents will then be stored in the file DXDOCS on the server.
You can find more details on how the Document command handler works (reusable part DX_DOCS) in the comments included in the component source RDML.
The WAM you will build in this exercise, iiiDspEmpDocs – Display Employee Documents, is a simple WAM that displays details for a single employee and a list of associated documents retrieved from file DXDOCS. When a document is selected it will be displayed in a new browser window.
File DXDOCS
Review the DXDOCS file definition in the Repository. Note that the file keys include all possible VLF instance list key fields. The highest level key contains the business object name. In this case, business object name will be DEM_ORG_SEC_EMP. See the VLF properties sheet for the Resources business object. The lowest level file key contains the document file name. For the business object Resources, the file key will be:
|
All keys not shown in the table will be blank.
Understanding BLOBs
Refer to the Technical Guide for a detailed explanation of how to use the BLOB data type.
BLOB is a variable-length binary field of undefined maximum length.
The most common operation with BLOBs are saving files into the database and retrieving them so they can be viewed/edited/etc. In RDMLX, BLOB fields are manipulated as filenames.
Following is an example of saving a JPG as a BLOB field in a database file:
#MYBLOB := 'C:\temp\mypicture.jpg'
UPDATE FIELDS(#MYBLOB) IN_FILE(FILE1)In RDMLX when a BLOB or CLOB field is used, keep in mind that the field contains a filename, not the actual data in the object. In RDMLX, LANSA LOB fields will be manipulated as filenames. It is only in database IO commands that the BLOB or CLOB actual data itself is handled by reading from or writing to the named file.
Rather than the default property .Value, fields of type BLOB have a default property called .FileName to clearly indicate that changing the "value" of the field is actually changing its default property which is a file name property.
When BLOB and CLOB data is read from the database, files are automatically created in the directory structures under the LPTH= directory (for more information, refer to Standard X_RUN Parameters in the Technical Reference Guide).
You can use the Documents command handler to store any type of document for an employee. For example, PDF, DOC, XLS, TXT etc.