Kbase P6707: How To Populate A Temp-Table From A SmartDataObject (SDO)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/24/2008 |
|
Status: Verified
GOAL:
How to populate a temp-table from a SmartDataObject (SDO)
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
To populate a temp-table that from a SmartDataObject, you do the following:
1) Define the temp-table in the definition section of whatever object you want
the temp-table to be in (in this sample code it is defined in the
SmartWindow).
DEFINE TEMP-TABLE ttCustomer NO-UNDO
FIELD CustNum LIKE Customer.CustNum
FIELD Name LIKE Customer.Name
FIELD Balance LIKE Customer.Balance
FIELD CreditLimit LIKE Customer.CreditLimit.
2) Place the following code at whatever place in your program where you want
to copy the data from the SmartDataObject to the temp-table.
DEFINE VARIABLE hdlToRowObjectBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hdlToTTCustomerBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hdlToSDOQuery AS HANDLE NO-UNDO.
hdlToSDOQuery = DYNAMIC-FUNCTION('getQueryHandle':U IN h_dsdo).
hdlToRowObjectBuffer = hdlToSDOQuery:GET-BUFFER-HANDLE(1).
hdlToTTCustomerBuffer = TEMP-TABLE ttCustomer:DEFAULT-BUFFER-HANDLE.
hdlToSDOQuery:GET-FIRST().
DO WHILE hdlToSDOQuery:QUERY-OFF-END = FALSE:
CREATE ttCustomer.
hdlToTTCustomerBuffer:BUFFER-COPY(hdlToRowObjectBuffer).
hdlToSDOQuery:GET-NEXT().
END.