Pattern 6: Classic Foreign Key Lookup Page

Previous Next

See Also

This design pattern is the default implementation for all info pages and lookup pages that correspond to child and parent tables in conceptual relationships.

In this default situation, all foreign key fields in a page contain a lookup button. When clicked, the user can select a record in the lookup page and returns. The selected values are then filled in the lookup fields.

This functionality is implemented in the following way:

· In the page corresponding with the child table, the TableColumns that are foreign key columns have a Lookup Page property set to the name of the Lookup Page, for example:

Tours scheduled as Scheduled Tours

· In the lookup page corresponding with the parent table, the TableDataSource has a Lookup element, with the Synchronization DataSource property set to the path to the child table, for example:

../SCHEDTOUR

This specifies that the primary key values to be selected in this lookup page are synchronized with the foreign key values in the calling (info) page.

· This Lookup element has LookupColumns for all key columns. The Synchronization Column property is set to the corresponding foreign key column.

 

· The lookup page, finally, contains a Select button with a closePage() action. This action has the Apply Changes property set to: Yes. This applies the selection to the fields in the calling page.

The Cancel button also has a closePage() action, with the Apply Changes property set to: No.

All implementations above also apply for self-referential relationships, where parent table and child table are the same table.

In the Definer, you can change the Lookup Method attribute of a relationship from Lookup Page (the default) to Dropdown List or Radio. This results in the appropriate lookup functionality.