Description
This method can be used to copy data from one temp-table to another. It takes care about the normal fields, but also the temp-table fields (with prefix t<datatype>).
It copies all fields from the current record in the temp-table represented by ihFrom, to the current record in the temp-table represented by ihTo.
Parameters
ihFrom | input | handle | The handle to the temp-table from which you want to copy the content. |
ihTo | input | handle | Handle to the temp-table to which you want to copy the content. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
QadFinancials
program code (program6/database.p)
FromField: DO viCnt1 = ihFrom:NUM-FIELDS to 1 by -1 :
vhFromField = ihFrom:BUFFER-FIELD(viCnt1).
if can-do ("ti,tg,tl,tc,td,th,tt,te,tr,ta,to,tm,tp",substring(vhFromField:name,1,2,"CHARACTER"))
then assign vcShortName = substring(vhFromField:name,3,-1,"CHARACTER")
vcFullName = vhFromField:name.
else assign vcShortName = vhFromField:name
vcFullName = "t"
+ entry(lookup(vhFromField:data-type,"integer,int64,logical,character,decimal,handle,date,recid,rowid,raw,com-handle,blob,clob"),"i,g,l,c,d,h,t,e,r,a,o,m,p")
+ vhFromField:name.
vhToField = ihTo:buffer-field(vcShortName) no-error.
if valid-handle(vhToField)
then do:
vhToField:BUFFER-VALUE = vhFromField:BUFFER-VALUE no-error.
next FromField.
end.
vhToField = ihTo:buffer-field(vcFullName) no-error.
if valid-handle(vhToField)
then do:
vhToField:BUFFER-VALUE = vhFromField:BUFFER-VALUE no-error.
next FromField.
end.
vhToField = ?.
DO viCnt2 = ihTo:NUM-FIELDS to 1 by -1 :
vhTemp = ihTo:BUFFER-FIELD(viCnt2).
IF vhTemp:data-type = vhFromField:data-type
AND vhTEMP:NAME MATCHES "*" + vcShortName
THEN IF vhToField = ?
THEN vhToField = vhTemp.
ELSE next FromField. /* do not copy if ambiguous */
END.
if vhToField <> ?
then vhToField:BUFFER-VALUE = vhFromField:BUFFER-VALUE no-error.
END.