When creating a course, choosing a unit is available in a dropdown as shown in the picture below. This is very simple to achieve, as soon as you choose the field type for the field Unit in Course to be of type Unit, you will see the following result.

See the Unit field below in the Course tipo, the type column shows the type as Unit:

Staff and Address - Embed Relationship
Lets say we'd like to capture staff home address and hence we have decided to add a new field Home Address
. We already have a predefined tipo Address
in the system with all the fields required to capture address. Why not simply refer to that Tipo instead of repeating all those fields again.

By adding Home Address field in Staff tipo with the type as Address
resulted in something like this:

That is certainly not what we want. To capture staff home address we'd like to have a form which contains all the fields in address, looks more like this:

Problem:
How to refer to another tipo and get all the fields of that tipo repeated in the current tipo. In other words, how to repeat fields in Address
tipo in the Staff
tipo.
Solution:
In order to embed all the fields of a referenced tipo, you simply have to change the relationship type to embed
. In our current scenario, open Staff
tipo and expand the Home Address
field to access the Relationship Settings
tab. See the setting below:

Note: There are few caveats about the embedded Tipos that you should remember:
- Similar to a field groups, embedded tipo will only show fields that are marked
Show In Basic View
first and then when user selects expand, the complete set of data will be displayed. - Embedded Tipo fields will also appear in list view if the
Show in List View
is turned-on for those fields. - When you select embed for a Tipo’s field and also specify that field as Mandatory, the field will pass validation as long as there is any value entered in the embedded Tipo’s fields.
Course and Unit : Reference Relationship
As shown at the beginning of this article, Unit is displayed in a dropdown when creating the Course. Unit field in course is of type Unit. When you examine the relationship settings of this Unit
field in course, it will look as below:

There is no relationship type set. When no relationship type is set, it assumed that relationship type is reference.
In reference relationship, you will be presented with dropdown to choose an object of related tipo, and when viewing you will get a link to the referenced object to click and navigate to that object as below:

By default, when two Tipos are related by reference, TipoTapp stores the referenced Tipo’s tipo_id
field against the current/containing Tipo and displays its Dropdown Label
field (if no field is set as Dropdown Label
, defaults to showing tipo_id
).
In the above course example, Unit name is set as Dropdown Label
you can see name displayed when linked in Course object. But when you navigate, it will navigate using the tipo_id to the correct unit details:

We’ve seen this already. However, you can change this default behaviour. You can configure your app so that another field is stored against the containing Tipo and another one is displayed.
To do this, you need to make the following changes to the Relationship Settings
of a field. You should change the value of Select Label Field
to the field you want stored and Select Key Field
to the field you want to display.
Remember to use the real field names and not their labels. The label if the value you put for the Field
field when creating the field e.g. First Name
while the field name is the field’s representation in the database. If you don’t set this, TipoTapp stores the lowercased equivalent of your label delimited by underscores, e.g. first_name
. You can see the Field Name of any field by looking at its Detailed View.
Comments
0 comments
Please sign in to leave a comment.