Support > Repository > Repetition > Repeat container - treat it as an independent model
ja | en

I will explain how to treat repeating containers as a separate independent model. By doing this, you can conduct a search with the item skewered.

We will make it possible to manipulate the repetitive container "Breakdown" included in the "Quote" model as a separate model "Quotation item". Figure 1 shows the image.

Repetitive containers are separate tables on the database, and table names are decided by the following rule.

Model ID + "$" + repeating container item ID
Fig. 1 Image dealing with repeated container as another model

Figure 2 shows the repeat container of the estimate model.

Fig. 2 Quotation model detail screen

The search screen of the added "quotation item" model is shown in Fig.Repeat container parts can be searched as data.

Fig. 3 Quotation item model search screen

Fig. 4 shows the list screen of the "quotation item" model.The contents are the same as in Fig. 1.

Fig. 4 Quotation item model list screen

Figure 5 shows an "estimate" model that defines repeating containers.

Figure 5 Definition of Quotation Model

Figure 6 shows the repetitive container part of the red frame in Figure 5 extracted and defined as the "quotation item" model.

The points of definition are as follows.

  • The primary key is the same as the "estimate" model.In this example it is "id".
  • A repeating container ID is required.The item ID is "repeating container ID +" jshid "".Type is integer type.In this example it is "precordjshid".
  • Two of "id" and "precordjshid" make it a composite primary key.(Activate "Use as primary key" for each of them.)
  • Items in the model should have the same item ID and same type as the reference source repeat container.The item name part can be changed.
  • Although it is possible to reduce items of referencing containers, they can not be added.
Figure 6 Definition of quotation item model

Figure 7 shows the setting of using the repeated container ID "precordjshid" as the primary key.We do not use the order.

Figure 7 Setting the primary key

Open "Screen> Other> Database Details" of the quotation item model.Invalidate "Create table" and specify "physical table name" directly as "quotation $ precord".Furthermore, cancel "Enable Cache".

Figure 8 Unset the table, specify the physical table name, disable the cache

Set not to update

Please do not register, update, or delete the "quotation item" model prepared as a separate model.It is assumed to operate with reference only.(Data input is performed only in the original "quote" model.)

Figure 9 Do not create new registration screen
Figure 10 Do not create updated screen

When you want to update

In the above explanation, "I will not create an update screen", but the reason is as follows.

  1. When updating with both the original model and the repeated container independent model, the consistency of the cache held in the memory can not be obtained.
  2. When both of them update processing at the same time, the locking mechanism is different because the lock key is different.

I will show you how to avoid this problem.

Do not use caching

For each of the original model ("estimate" in the above example) and the repeated container-independent model ("estimate item" in the example above)Disable caching.Performance is disadvantageous.

Operate not to be updated at the same time

For example, prepare a control flag in the quotation.According to this flag value, one update button is invalidatedButton display control formula preparedThen avoid concurrent updates.

Make the lock key the same

Adjust the lock key of the repeating container-independent model ("estimate item" in the example above) to the original model ("estimate" in the example above).In this case, it is impossible to control the locking of each individual record unit of the repeated container independent model.(It is because it becomes one lock key in the whole repeated container row.)