Exercise Five - Create the Lookup Relationship

Top  Previous  Next

Set the Relationship for the Customer and States tables:

 

1.

Highlight Customer in the DCT Explorer, then press the Add Relation  button located directly above the Relations view.

The New Relationship Properties dialog appears. This is where you define the relationship.

2.

Make sure the Type drop list is set to MANY:1.

3.

In the Foreign Key drop list, press the down-arrow key to display the choices, highlight None, and then press the TAB key.

This is no key required on the Customer table (the Many side of the relationship). You will always be "looking into" the States table and never the other way in this example.

4.

In the Related Table drop list, press the down-arrow to display the choices, highlight States, and then press the TAB key.

5.

In the Primary Key drop list, press the down-arrow to display the choices, highlight Sta:StateKey, and then press the TAB key.

This is the key on the States table (the One side of the relationship) that will be used to link the two tables.

Next, the linking columns in the keys must be "mapped" so the Application Generator can know exactly which columns in the two tables are related to each other. Since we used identical column names, this is easy.

6.

Press the Map By Name button.

The linking columns between the two tables appear in the two Column Mapping list boxes. This is one reason to name linking columns the same.

If you did not have a matching column name, no problem! Simply double-click on the Columns Mapping entry, and select the linking field from the popup window provided.

Since the table relationship defined is only in one direction, Referential Integrity Constraints are not needed.

7.

Press OK to close the New Relationship Properties dialog. Press Cancel to exit the Relationship Properties dialog.

 

 

Exercise Six - Set the Lookup Validity Check