Consultor Eletrônico



Kbase P15780: How to copy information from buffer to buffer ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/4/2011
Status: Verified

GOAL:

How to copy information from buffer to buffer ?

GOAL:

How to use Buffer-Copy ?

GOAL:

How to copy records to a temp-table to another without having to do a for each and create?


GOAL:

How to copy data from one temp-table to another

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.1x
OpenEdge 10.x

FIX:

To make a copy from a buffer to another buffer you can use BUFFER-COPY statement.

The syntax to use the Buffer-Copy is :

BUFFER-COPY source [ EXCEPT | USING] TO target [ASSIGN Assign Expression] [NO-ERROR] .

The code below shows an example of BUFFER-COPY to copy each field, except for BinName,
from the Bin table in the Sports2000 database into the corresponding field in the ttBin temp-table.

/*Define temp-table ttBin with WarehouseNum, ItemNum,Qty, BinNum, BinName fields.*/
DEFINE TEMP-TABLE ttBin
FIELD WarehouseNum LIKE Bin.WarehouseNum
FIELD ItemNum LIKE Bin.ItemNum
FIELD Qty LIKE Bin.Qty
FIELD BinNum LIKE Bin.BinNum
FIELD BinName LIKE Bin.BinName.

EMPTY TEMP-TABLE ttBin.

/*Copy each field, except BinName, from Bin table in Sports2000 database into corresponding field in ttBin temp-table*/
FOR EACH Bin NO-LOCK:
CREATE ttBin.
BUFFER-COPY Bin EXCEPT Bin.BinName TO ttBin.
END.

/*Display each ttBin record in ttBin temp-table.*/
FOR EACH ttBin:
DISPLAY ttBin WITH 1 COLUMN.
END.