Master/Detail One-To-Many forms

Frequently, you may have data in one table that is related to data in another table in a one-to-many relationship. For example:

You may want to display this type of relationship in a form. Such a form is called a master/detail one-to-many form.

For example, the following form displays information about one department at the top and all of the employees of that department at the bottom:

The sample shows a master / detail one to many form labeled Departments and their Employees. The center top section displays fields for the department name, I D, and Manager I D. Below is a scrollable grid that displays six rows of data in columns labeled Employee I D, First Name, Last Name, Street, City, State, and Zip Code.

NoteAbout the ID column Note the ID of the department in the master table at the top of the form. Although you cannot see the ID of the department in the detail table at the bottom of the form, it is there. The ID has been hidden by moving grid boundaries to cover the ID column. Since all the ID values are the same, hiding the values is useful.

If the detail table did not include the ID, the form would not be updatable. If you forget to include necessary columns, InfoMaker prompts you.

The following illustration shows the database tables that handle the data on this form: the Department table and the Employee table in the EAS Demo DB. The Department table is the master table, and the Employee table is the detail table.

Note that there is a primary/foreign key relationship between the tables: the Dept_id column in the Employee table has the same values as the Dept_id column in the Department table:

Shown are the Department table and the Employee table. The dept _ i d column has an icon with a P in the department table and an F icon in the employee table. Emp _ id has a P icon in the employee table and is linked to an F icon next to dept _ head _ i d in the department table.