Relations reference

Relations connect models. Different relation types are available and can be easily identified in both the schema and list views.

Updated over a week ago

Relations represent the connection between models. The relation type determines the connection between individual models. You can open a detailed view of the relations between models from either the schema (visual interface) or the list view.

Displaying relations in the schema view

The relation details are displayed as shown by the lines connecting the various models.

A. The details of the relation between the two models is displayed. In this case, a Belongs to relation has been created that indicates that many tasks can be related to a team.

B. You can apply a name to the relationship.

C. You can close the pane displayed by pressing the Close (X) button.

D. If you make changes such as applying a default value, press the Save button to ensure that your changes are saved.

E. If a relation is incorrectly defined, you can press the Delete button to remove the relation. A message is displayed that requests you to confirm. Press either:

- Delete to permanently delete the relation

- Cancel if you want to retain the relation as defined.

Showing multiple relations in the schema view

Models can have multiple relationships as shown in the following example:

Where a self-referencing relation is defined, the relation appears as shown here.

Self-referencing relationships involve only a single model. For example, an Employee model that represents the employees in an organization. Various employees can be assigned as supervisors or team leaders for multiple employees. In this case, the source and target table are the same.

Showing multiple relations between models

Where a model has multiple relations, a count of the number of relations is shown in the schema view.

1. Click on the relation line. An overview of the relation types is displayed. In the following example, the overview is labelled Room-Reservation.

2. Select one of the relation types from the list displayed. The relation details are detailed in the pane that is opened.

You can switch the relation details by clicking in the overview of relation types (Room-Reservation) that is still displayed.

Note: If you make a change, for example, to add additional details for a relation, press Save to ensure your changes are saved before either closing the pane with the close button (X) or pressing Cancel.

How self-referencing relations are shown

Where a self-referencing relation is defined, the relation is shown as a loop back to the model in the schema view.

Self-referencing relationships involve only a single model. For example, an Employee model that represents the employees in an organization. Various employees can be assigned as supervisors or team leaders for multiple employees. In this case, the source and target table are the same.


Working with Relations in the list view

You can display the relations details for a model in the list view. Where you have just newly created a model, a message is displayed that this model does not have any relations yet.

Creating new relations in the list view

Click on the New relation button to open the New relation pane. Select the Type of relation and use list displayed from the Associated model field to select the target model from the list of models available. Assign a name to the relation and press the Save button. A message that the relation is successfully created is displayed. Close the pane to return to the Relations tab for the Car model. The newly created relation is shown in the table with the name assigned. You can repeat this process to apply additional relations as required to the model.

Once applied the details of the relation are shown in the list view of the relations tab.

Applying additional settings for Belongs to relations

Where a Belongs to relation is applied between models, you can add additional details. You can use the Dynamic value button to set that a default value based on an expression is applied, for example, where a property field is left blank. You can also specify whether validations are required.

Did this answer your question?