Consultor Eletrônico



Kbase P73195: How to populate a dynamic SmartDataObject (SDO) based on a Temp Table
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/09/2005
Status: Unverified

GOAL:

How to populate a dynamic SmartDataObject (SDO) based on a Temp Table, on an Appserver.

GOAL:

How to populate a dynamic SmartDataObject based on a Temp table.

FACT(s) (Environment):

Dynamics 2.0A
Dynamics 2.1A

FIX:

This example uses initializeObject to populate a dynamic SDO's temp table that is running on an Appserver.

1. Create a database named 'temp-db' and connect to it in the Dynamics Development session.
2. Create a table in the 'temp-db' database that will provide the Temp Table definition. Since the table is defined in a 'temp-db' database, progress will treat it's tables as temp tables, and the 'temp-db' database will only need connection at design time. For this example a table 'temp-db.table1' is used which has a single character field 'field1'.
3. Generate Entities for the table defined in the 'temp-db' database.
4. Create a dynamic SDO based on a Temp Table. In the Temp Tables table selector, choose the 'temp-db' database and the 'table1' table. Save the SDO.
5. Create a dynamic SDB based on the Temp Table SDO.
6. Create an independent window with the dynamic SDO and SDB and link them with a data link.
7. In the dynamic SDO logic procedure, create and 'initializeObject' override procedure with the DB-Required flag checked 'ON'. Add the following code:
FOR EACH salesrep NO-LOCK:
CREATE table1.
table1.field1 = salesrep.salesrep.
END.
RUN SUPER.

8. Disconnect the temp-db database and the code will run in the design time session. It will also run on the Appserver.
9. You could also populate the temp table from the SDO mainblock with the following code:
{&DB-REQUIRED-START}
FOR EACH salesrep NO-LOCK:
CREATE table1.
table1.field1 = salesrep.salesrep.
END.
{&DB-REQUIRED-END}