Buffer-copy - Error 9034

djeanveau

New Member
Please, why am I getting this error in the following simple piece of code ?

Pair with fRECID failed to have a member in each table (9034).

---------------------------------------------------------------------------------------------

DEF VAR tth AS HANDLE.
DEF VAR bh AS HANDLE.
DEF VAR qh AS HANDLE.
DEF VAR buf-t1-hndl AS HANDLE.
DEF VAR buf-t2-hndl AS HANDLE.
DEF VAR fld1 AS HANDLE.
DEF VAR fld2 AS HANDLE.
DEF VAR vRECID AS RECID.

/* get database table handles */
buf-t1-hndl = BUFFER padepts:HANDLE.

/* create an empty temp-table */
CREATE TEMP-TABLE tth.
/* give it imported table field and index */
tth:CREATE-LIKE(buf-t1-hndl).
/* add field RECID */
tth:ADD-NEW-FIELD("fRECID","RECID").
/* no more fields will be added */
tth:TEMP-TABLE-PREPARE("xdump").

/* get the buffer handle for the temp-table */
bh = tth:DEFAULT-BUFFER-HANDLE.

/* populate requested temp-table */
FOR EACH padepts:

bh:BUFFER-CREATE.
bh:BUFFER-COPY(buf-t1-hndl).
bh:BUFFER-COPY(buf-t1-hndl,?,"fRECID,RECID(padepts)"). /* RECID(padepts) */

END.

/* run test query to access temp-tale */
CREATE QUERY qh.
qh:SET-BUFFERS(bh).
qh:QUERY-PREPARE("FOR EACH xdump").
qh:QUERY-OPEN().

fld1 = bh:BUFFER-FIELD("uid").
fld2 = bh:BUFFER-FIELD("fRECID").

/* display test */
REPEAT:
qh:GET-NEXT().
IF qh:QUERY-OFF-END THEN LEAVE.
DISPLAY fld1:BUFFER-VALUE().
DISPLAY fld2:BUFFER-VALUE().
END.

qh:QUERY-CLOSE().
bh:BUFFER-RELEASE().
 
The field-pair-list in your buffer-copy method does not allow for functions. Try this instead

Code:
/* populate requested temp-table */
FOR EACH padepts:
bh:BUFFER-CREATE.
[b]bh:BUFFER-COPY(buf-t1-hndl). [/b]
[b]	ASSIGN fld1 = bh:BUFFER-FIELD("fRECID")
		 fld1:BUFFER-VALUE = RECID(padepts).
[/b]END.
 
Top