Support > Repository > Parent-child relationship > Link multiple children to one parent

We will show an example of preparing two child models "customer" as parent model and "support" "buying".

More than one child can be specified for linking models with foreign keys.Figures 1 and 2 show examples in which the customer model is the parent and two child "purchasing history" "support" models are prepared.

Figure 1 New registration buttons for multiple child models are prepared on the detail screen of the parent model
Figure 2 When a child model is registered (on the details screen of the parent model)

Display order in parent model

It is arranged in dictionary order of model ID (English).

Figures 3 and 4 show the definition of purchase history model and support model prepared this time.
Specify the type of the item specified as the foreign key with the same type as the type of the referenced item.In this example, "customer ID" is specified as "numeric" type.

Figure 3 Definition of Purchasing History Model
Figure 4 Definition of support model

In the "Customer ID" item, set the foreign key.
Specify the parent model for "foreign key> model name".

Figure 5 Definition of Foreign Key

"Referenced item name" is the item on the child model side isSame nameCan be omitted.(This time it is the same "customerid", so you can omit it.)

Figure 6 Definition of foreign key (when referencing item name is omitted)

Child models on the parent model details screen are stored in tabs by default.(Fig. 1, Fig. 2) Child models can be displayed vertically as shown below, not tabs.

Figure 6 Display multiple child models vertically

Definition method

Modify the screen definition of the child model.

Uncheck "Screen> Search/list display> External key coordination> Display method> Tab layout".By standard, it is checked.

Figure 7 Using tab layout
Figure 8 Do not use tab layout
If there are multiple child models (as in this example), please set whether to use tab layout for all child models or not.It is possible to mix, but usually it will be unified into either.

When multiple child models are linked to one parent model, the display order is "dictionary order of model IDs of child models".Figure 9 is an example of a model ID called ask and support.

Fig. 9 Dictionary order of child models ask and support

You can change this order.

Figure 10 Example of Changing the Order of Child Models

Even if tab layout is not used, this display order is applied.

Figure 11 When not Using Tab Layout

Definition method

Specify the "tab display position" of "Screen> Search/list display> Foreign key linkage" with the following format.

Parent Model ID:Position

Link multiple parents to one childWhen settings are made, you can specify them by separating them with a comma as follows.

Parent Model ID:Position,Parent Model ID:Position,...

The position number is counted from "1".

Fig. 12 Set the display position of the child model "support" to 1
Fig. 13 Set the display position of the child model "inquiry" to 2
When making this setting, please specify for all child models.If an unconfigured child model is included, unset will be positioned first.
If the position number is duplicated, the dictionary order of the first rule, model ID, is applied.