Skip to main content

Add a Form with a Dependent Table

Last updated 10/05/2024

Dependent Tables

The Dependent Data Source field will only list tables that have a dependency established in the database. If there are no dependent tables, the dropdown will display No Options.

Inheritance allows child tables to inherit the common field attributes from a parent table creating a parent-child relationship. This causes the child table to inherit the fields and constraints from its parent along with its own defined fields.

When selecting a dependent table you will have access to the fields from both tables to use on your form.

Example

The following diagram shows the children tables inherit all the fields of their parent table, plus have additional fields unique to themselves. The parent table has a Type (EntityType) field to hold the type of child.


Dependent diagram
Figure 1 - Dependent diagram

The MotorDealer, Contact, and Customer tables all inherit the field attributes from the Entity table along with their own defined fields.

Requirements to Set Up a Dependency

  • The main data source must have a Type field of some description. The type indicator is a way to determine the type of entity. For this example, the Entity table has an EntityType field to indicate whether the entity represented by the table row is a motor dealer, contact, or customer.

  • EntityType table field
    Figure 2 - EntityType table field

  • The Type (EntityType) field on the form requires a default value to be stored in the database for the parent table. For this example, C for Customer.

  • Default Value field
    Figure 3 - Default Value field

  • The Show If field for the Type (EntityType) field will need to be set to
    false
    to hide the field on the form.

  • Show If field
    Figure 4 - Show If field

Add a Form with a Dependent Table

1. Click the Add Item button, give your form a title, and select a data source.

info
The data source needs to be the parent table.

Add a form
Figure 5 - Add a form

2. Select a dependent data source in the Dependent Data Source field.

info
The dependent data source needs to be a child table.

Dependent Data Source field
Figure 6 - Dependent Data Source field

3. Click the Pages tab.


Pages tab
Figure 7 - Pages tab

4. Click the Add Pages button.


Add Pages button
Figure 8 - Add Pages button

5. Give your page a caption and click the Fields tab.


Fields tab
Figure 9 - Fields tab

6. Click the Add Fields button.


Add Fields button
Figure 10 - Add Fields button

7. Select the Type field in the Field field.

info
The fields from both data sources will be available in the Field field.

8. Type
false
in the Include In List If field.


info
This field is purely used to store the type in the database, you do not want to show the value in a list.

9. Select _Text in the Display Type field.

10. Type a value in the Default Value field.

info
The value in the Default Value field will be stored in the database and will define what type of entity is being saved.

Add the Type field
Figure 11 - Add the Type field

11. Click the Display tab.


Display tab
Figure 12 - Display tab

12. Click the Cancel button in the Show If field and type
false
.


13. Click the Save button in the form app bar and continue to add all the fields your form needs by clicking the Add Fields button each time.


Save button
Figure 13 - Save button

14. On completion click the Save buttons in the form app bars.


Save buttons
Figure 14 - Save buttons