
Once you have selected which automatically created pages to include in your application, you can quickly and easily configure certain pages to be “master-detail” pages (also called “parent-child” or “one-to-many” pages).
Master-detail pages typically express a parent-child relationship between a parent record and its itemized detail in the child table. For example, an Order record (the parent) may have multiple line items in the order in a separate Order Details table (the child). Showing the line item detail on the same page as the parent record is a common need in many applications.
|
|
|
This page shows an example of a child table displaying the details relating to the parent record. |
For example, if you an online store and need to keep track of orders and all of the items that have been ordered, then in relational databases such as Oracle, Microsoft SQL Server or Microsoft Access, you can create an Order table and an Order Item table as follows:
Order Table:
- Order Id
- Order Date
- Name
- Address
- etc.
Order Item Table:
- Order Item Id
- Order Id
- Item
- Unit Price
- Quantity
- etc.
In this example, the Order Item table is considered a ‘child” table (also called a “detail” table). The Order table is considered the “master” or “parent” table. The reason the Order Item table is considered a child table is because it contains a reference to the Order table using the Order Id.
However, just adding an Order Id field to the Order Item table is not sufficient. You also need to tell your database about the relationship by establishing a “foreign key” relationship between the Order Id field in the Order Item table and the Order Id field in the Order field. When you define this foreign key relationship, your database can enforce the relationship between the two tables and ensure that your data has “referential integrity”. For example, if you attempt to delete an order from the Order table, your database will not allow the deletion of this order until all of the related order items in the Order Items table that refer to the order are deleted as well.
Master-detail record-to-table relationships may be added to any Add Record, Edit Record, and Show Record page that have a foreign key relationship with another database table, database view or query. Iron Speed Designer uses these foreign key relationships to determine which tables can be included. Moreover, your generated application will properly add the Master record into the database first, get its primary key (ID) and then store the ID in the Detail records associated with the Master record.
|
Option |
Description |
|
Include |
Selects which detail (child) tables to include on the master-detail page. |
Sometimes, you may not be able to define the foreign key relationship in the database itself because you lack permission to change the database’s schema. In this case, you can define the foreign key relationship as a “virtual foreign key” in Iron Speed Designer. The Virtual Foreign Key (VFK) relationship emulates a Foreign Key relationship as far as your application is concerned. (The Virtual Foreign Keys feature is available in Iron Speed Designer Enterprise Edition only).
Configuring Table and Record Panels