Kbase 21974: Simple Example Using INSERT-FILE() Method
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  17/04/2002 |
|
SUMMARY:
This is a simple example to show you how to use the INSERT-FILE() Method. In this sample code, INSERT-FILE() is used to get some data from a file and save it into a record. It is assumed that there is one file per record.
SOLUTION:
/* You need an editor to get the information from the file, and because INSERT-FILE() applies to the Editor widget */
DEFINE VARIABLE veditor AS character
VIEW-AS EDITOR
INNER-CHARS 16
INNER-LINES 2
MAX-CHARS 70.
DEFINE VARIABLE vlog AS LOGICAL NO-UNDO.
DEF FRAME frmx veditor.
FOR EACH customer EXCLUSIVE-LOCK:
vlog = veditor:INSERT-FILE("test" + customer.custnum + ".txt").
if vlog = 'YES' then
ASSIGN customer.NAME = veditor:SCREEN-VALUE.
/* This deletes the data within the editor widget */
veditor:SCREEN-VALUE ="".
END.