Support > Repository > Parent-child relationship > Simultaneous update of child models
ja | en

In foreign key relation, child model can be updated directly on the update screen of parent model.

We treat "customer" model and "support" model as examples.
N customer support information is associated with one customer.At this time, you can update N support information (linked) on the customer model update screen.

Figure 1 Customer model update screen (child models can be updated at the same time)

Definition method

All settings are done with the support model (which is a child model).There is no setting on the parent model side.

In the support model, include "customer ID" which is a foreign key in the search condition.

Figure 2 Including Foreign Keys in Search Conditions

"Customer ID" is set to save the value in the database at the time of registration.

Figure 3 Setting to save the value in the database at registration

Similarly, in the detailed definition of the "customer ID" item, make the range search effective, or make the conditional expression "equal". In other words, you set either Figure 4 or Figure 5.

Figure 4 When range search is enabled
When the conditional expressions are equal to each other
The purpose of this setting is to make it possible to specify the reference destination of the foreign key.Therefore, for example, when the foreign key is "character type", you can not specify "partial match search".

We will create a "list update screen" of the support model.

Fig. 6 Creating list update screen

Activate the simultaneous update function of foreign keys provided in the setting field of the list update screen.(It is enabled by default.)

Figure 7 Enabling simultaneous update function of foreign key

Restriction

This function is realized using the "list update screen".for that reason,Specifications and restrictions of this function conform to the list update screen.

By using the "input check" button, you can check the input of the child model.(List update screenIt is equivalent to the input check function of.)

Figure 8 Input check

Display control of input check button7.9.2

You can control the display of input check buttons.It becomes the setting of the registration/update screen of the parent model side.

Figure 9 Input Check Button Display Control

You can specify the initial display number of the child model. On the registration screen of the parent model (customer model in this case), records are displayed for the initial display number specified as shown in Fig. 10.

Fig. 10 Customer registration screen.The initial display number is reflected.

Definition method

In the support model list maintenance screen setting, set "simultaneous update function of foreign key> initial display number".

Figure 11 Specifying the initial display number

More than one model can be linked with a foreign key.At this time, simultaneous updating of child models also works.

Figure 14 Defining multiple child models for one parent model

In a model that is related to a foreign key, when copying is registered, all child models linked to the parent model are also copied.

In Figure 15, we prepared a copy registration function in the customer model. Clicking on the copy button transitions to the copy registration screen.

Figure 15 Copy registration button for customer model

On the copy registration screen of the customer model, if there is relevant support data, you can see that this is also copied at the same time.(Figure 16)

Fig. 16 Customer copy registration screen.The relevant support data is also copied.

Definition method

In the customer model, enable "Search/list display> button display> copy registration button".

Figure 17 Preparing the copy registration button

In the support model, set "Update List> Update Foreign Keys Simultaneously> Enable Concurrent Updates" and set "Copy child model when copying parent model".(This setting is enabled by default.)

Figure 18 Copy child model when copying parent model

With multiple foreign key child models

This copy function works even with a parent model with two or more foreign key child models.

"Business logic> Initial value> [Example] When initializing a parent model with parent-child model simultaneous updating function, set different initial values ​​for each child modelPlease read.