Skip to main content

Create a Form with a Dependent Table

Last updated 1/02/2022

Dependent Tables in Five

Initially opening a new Form Wizard, the Dependent Table field will be captioned with Select a Main Table. This is because a main table needs to be selected before the Dependent Table field will become available. Only if the main table has dependent tables established in the database will there be options to select in the Dependent Table's lookup list.

Five supports the object-relational mechanism known as inheritance. Inheritance allows a table to inherit some of its column attributes from another table creating a parent-child relationship. This causes the child table to have each of the same columns and constraints as its inherited table as well as its own defined columns.

When selecting a dependent table in Five you will have access to the fields from both tables to select for your form.

Example

The following diagram shows the child entities inherit all the elements of their parent entity, plus have some additional ones unique to themselves. The parent entity takes on a 'Type' column to hold the type of entity. In the diagram below, we can see the Entity table has three dependent tables. The EntityType column in the Entity table is to store the type of entity.


Dependent Diagram
Figure 1 - Dependent diagram

The Customer table is one of the tables that has a dependent relationship with the Entity table. Inheritance is the mechanism that connects the Customer table to the Entity table, allowing the Customer table to automatically acquire the Entity (parent) table's properties and columns.

Add a Form wth a Dependent Table

Requirement

The main table must have a 'Type' field. The type indicator is a mechanism for determining the type of entity. For example, the Entity table may include an indication of whether the entity represented by the table row is a customer, motor dealer or contact.

Prerequisite

The dependent relationship must be established at the table-level.

Post-Requisites

You will need to edit the Customer form after saving the Form Wizard to perform the following modifications to the Type field.

  • The Default Value field will need a value entered that will automatically be stored in the main table (parent - Entity) in the database. For example, C for Customer.
  • The Show If field will need to be set to false so the field will not be shown on the form.

Steps

  1. Click the New Form Wizard button in the list app bar.

New Form Wizard button
Figure 2 - New Form Wizard button

  1. Click the lookup icon in the Main Table field and select the main (parent) table. For this example, the Entity table.

  2. Click the lookup icon in the Dependent Table field and select the dependent (child) table. For this example, the Customer table.

  3. Click the Next button.


Add a Form wth a Dependent Table
Figure 3 - Add a form with a dependent table

  1. Select the checkbox for each field that is to be mandatory.

  2. Select the checkbox for each field that is to be included in the list.

  3. Click the Save button in the wizard app bar.


Select the Checkboxes and Save the Form
Figure 4 - Select checkboxes and save the form

info

All the fields from both tables are listed.