Kbase 19404: 4GL: How to Use the Raw Transfer Method With a Dynamic Temp-Table
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
Status: Verified
GOAL:
How to use the raw transfer method with a dynamic temp-table.
GOAL:
How the interaction between the raw-transfer statement, static, and dynamic buffers works.
FACT(s) (Environment):
Progress 9.x
FIX:
In Progress Version 9.1A, a new method for the buffer object was created that allows you to perform a raw-transfer. The method syntax is as follows:
buffer-handle:raw-transfer(tomode,handle).
tomode is a logical expression.
If tomode is true, the direction of transfer is from buffer-handle to handle. If tomode is false, the direction of transfer is from handle back toward buffer-handle. Handle is the handle of either a buffer-field or another buffer object.
You might want to transfer a raw variable to a dynamic temp-table buffer. Since you can not have a buffer-field object for a program variable, you must create a temp table with one (1) field in it. The code for this solution is as follows:
DEFINE TEMP-TABLE ttfld FIELD r-raw AS RAW.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE hbuf AS HANDLE NO-UNDO.
DEFINE VARIABLE hf-raw AS HANDLE NO-UNDO.
DEFINE VARIABLE tth AS HANDLE NO-UNDO.
DEFINE VARIABLE bh AS HANDLE NO-UNDO.
DEFINE VARIABLE fh AS HANDLE NO-UNDO EXTENT 10.
hbuf = BUFFER ttfld:HANDLE.
hf-raw = hbuf:BUFFER-FIELD("r-raw").
FIND FIRST customer NO-LOCK.
CREATE ttfld.
RAW-TRANSFER customer TO r-raw.
CREATE TEMP-TABLE tth.
tth:CREATE-LIKE("customer").
tth:TEMP-TABLE-PREPARE("mytt").
bh = tth:DEFAULT-BUFFER-HANDLE.
bh:BUFFER-CREATE.
bh:RAW-TRANSFER(FALSE,hf-raw).
REPEAT i = 1 TO 10:
fh[i] = bh:BUFFER-FIELD(i).
DISPLAY fh[i]:BUFFER-VALUE.
END.