User Tools

Site Tools


exercise_six_create_the_lookup_relationship.htm
Navigation:  User's Guide and Tutorials > Getting Started with Clarion! >====== Exercise Five - Create the Lookup Relationship ====== Previous pageReturn to chapter overviewNext page

Set the Relationship for the Customer and States tables:

1.Highlight Customer in the DCT Explorer, then press the Add Relation AddTable.jpg 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.

NoteBox.jpg

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.

AfterStatesRel.jpg

Exercise Six - Set the Lookup Validity Check

exercise_six_create_the_lookup_relationship.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1