Consultor Eletrônico



Kbase P111124: How do you store an object in a temp-table?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   26/01/2006
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.1x

SYMPTOM(s):

How do you store an object in a temp-table?

How do you cast an object from one type to another?

FIX:

The following code shows how to store an object in a temp-table and how to retrieve it back out of the temp-table and cast it back to its original self:

DEFINE TEMP-TABLE ttClassHolder NO-UNDO
FIELD anObject as CLASS PROGRESS.Lang.Object.

DEFINE VARIABLE vObject AS CLASS Test2.
DEFINE VARIABLE vLoop AS INTEGER NO-UNDO.
DO vLoop = 1 to 100:
vObject = NEW Test2().
CREATE ttClassHolder.
ASSIGN anObject = vObject.
END.
FOR EACH ttClassHolder:
vObject = CAST(anObject,Test2).
DELETE ttClassHolder.
DELETE OBJECT vObject.
END.