Consultor Eletrônico



Kbase 18009: How to use foreign keys to link SmartDataObjects (SDO) that use the database as their Data Source.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/11/2008
Status: Verified

GOAL:

How to use foreign keys to link SmartDataObjects (SDO) that use the database as their Data Source.

GOAL:

Using Foreign Keys With SmartObjects in Version 9

FACT(s) (Environment):

Progress 9.x
All Supported Operating Systems

FIX:

External tables are no longer supported with ADM2, only foreign key support is available. The example used in this solution describes how to use a foreign key between a SmartDataObject for customers and a SmartDataObject for orders. Each SmartDataObject will have an associated SmartDataViewer.

1) Create a SmartDataObject with a query for each customer that contains the fields you would like displayed in the viewer.

2) Create a SmartDataObject with a query for each order that contains the fields you would like displayed in the viewer (be sure to include the customer number field since that will be used as the foreign key).

3) Create a SmartDataViewer for the customer table using the SmartDataObject defined in step #1.

4) Create a SmartDataViewer for order table using the SmartDataObject defined in step #2.

5) Create a new SmartWindow.

6) Drop the customer SmartDataObject onto the window.

7) Drop the customer SmartDataViewer onto the window. Link the customer SmartDataObject to the customer SmartDataViewer with a Data link.

8) Drop the order SmartDataObject onto the window. Link the customer SmartDataObject to the order SmartDataObject with a Data link. Make sure that the order SmartDataObject is the TARGET for the link.

9) The Progress Advisor then asks if you'd like to specify the foreign fields for the order SmartDataObject. Choose to specify them. This brings up a multi-field mapping dialog where you can choose to map Order.Cust-Num to Cust-Num in the Source.

What you should see for mapped fields at the bottom of this dialog is:

CustNum,Order.CustNum

10) Drop the order SmartDataViewer onto the window. Link the order SmartDataObject to the order SmartDataViewer with a Data link.

11) Add navigation SmartPanels and link them to the SmartDataObjects.


When this window is run you should be able to navigate through all customer records and their associated orders. As you change the customer record that you are looking at, the order viewer is changed to display the orders for the particular customer that you are viewing.