Support > Repository > Screen function > Main model and sub model
ja | en

Multiple list display screen, detailed display screen, registration screen can be created for one model.

When creating multiple screens with one model, first define the main model (hereinafter referred to as "main model"), then copy the definition content and call it a new model (hereinafter referred to as "submodel" Define it. Multiple submodels can be prepared for one main model.

Figure 1 Configuration image of main model and submodel
  • Multiple screens can be prepared, but the model exchanging data itself is one.
  • In the database, a common table is used for the main model and the submodel.
  • Since the submodel is in the subset relation of the main model, you can delete existing items (except for the primary key) and reduce them, but you can not add new items that are not in the main model.[More ...]

Select one main model.

Figure 2 Select one main model

Select "Template> Submodel" from the gear icon.

Figure 3 Creating a submodel

By default, a model given "- submodel" as a model name is newly created.The model ID is given the number "1".

Figure 4 Submodel was created

Open the submodel definition.Please first change the model name and model ID appropriately.

Figure 5 Change model name and model ID of sub model

Here I tried adding the name "[sub]" to every item name.(The item name can be changed.Item ID can not be changed.)
In addition, I deleted the item named Remark.(You can reduce items in the submodel.)

Figure 6 Fine modification of submodel definition for testing

First, let's register the data from the submodel.

Figure 7 Operating from submodel

Figure 8 shows an example of registering one data from a submodel.

Fig. 8 One submodel data was registered

Next I will search the main model.

Fig. 9 Search the main model

In the main model, data registered from the submodelshareYou can see that it is done.(The table is shared, so it is shared.)

Figure 10 Search results of the main model are the same as submodels

smartphone

The smartphone version screen can be applied to a subset (a part) of the PC version.We will use the PC version model as the main model and the model used on the smartphone as the sub model.The submodel is handled as a part of the main model item.

Then enable the "Use on smartphone" setting for the submodel.

Multiple list display screen

You can create multiple list display screens on one model using submodels, and so on.It is also useful when you want to divide the screen to access for each user.

Security

It can be applied to a design that shows the main model to authorized users and shows submodels with few items to unauthorized users.

Example of execution

Here is an example of using submodels to divide screens that can be operated for each user's authority.

In this example, we have two accounts "Yamada" and "Suzuki".

accountPrincipalmodel
YamadaCustomer managementCustomer (main model)
SuzukiGeneralCustomer (for general users) (submodel)

Fig. 11 shows an example of operation of the customer list display screen by the user Yamada.

Fig. 11 Customer list display

Fig. 12 shows an example of the operation of the customer list display screen by the user Suzuki.This submodel does not contain "phone number" item.

Figure 12 Customer (for general users) list display

Figures 13 and 14 show the principals of each user.

Figure 13 User Yamada has a principal "customer management".
Figure 14 User Suzuki has a principal "general user".

Depending on the principal, you can change the models that can be operated.For users Yamada and users Suzuki, the model displayed in the logon menu differs.User Yamada manipulates the main model and user Suzuki manipulates the submodel.

Figure 15 User Yamada can operate the main model "customer"
Figure 16 User Suzuki can operate submodel "customer (for general user)"

The system administrator can operate all models.

Figure 17 System administrator can operate both main model and sub model

Setting method

For the "customer" model, we prepared a submodel "customer (for general users)".(reference:How to create a submodel)

Figure 18 "Customer" and "Customer (for General User)" Model

Fig. 19 shows the main model "customer", and Fig. 20 shows the submodel "customer (for general user)".Submodel has been deleted "mail address" and "phone number".

Figure 19 Main model "Customer"
Figure 20 Submodel "Customer (For General Users)"

Setting permissions

Delete the principal "general user" that was originally from the main model "customer".

Figure 21 Deleting principal "general user"

We will prepare a new principal "customer management".Allow all operations.

Figure 22 Add Principal 'Customer Management' (1)
Figure 23 Add principal 'Customer Management' (2)

The principal of the submodule "customer (for general user)" invalidates the authority of the update system.This will allow you to only view.

Figure 24 Principal of submodel "Customer (for general users)" (1)
Figure 25 Principal of submodel "Customer (for general users)" (2)

After creating the submodel, you can change (your own) main model. Specify "Main model name" from "Screen> Other> Relationship of model".

Figure 11 Changing the Main Model Name

Example of execution

Figure 12 shows the customer (submodel) list display screen.If you press the "details" button here, it will transition to the customer (main model).(FIG. 13)

Figure 12 Customer (submodel) list screen
Figure 13 Customer (Main Model) Detail Screen

Definition method

Prepare the submodel.

Figure 14 Preparing a submodel

In the submodel's "Screen> Search/List display> Detail button", specify its own parent model from "transition destination model ID".

Figure 15 Specify the transition destination model ID
This function is not limited to the parent model as the transition destination target.If the primary key (name, type) is the same, you can also transition to a different model.

In the case of displaying the child model list in the foreign key cooperation

In the foreign key linkage, you can specify the transition destination of "detail" button and "update" button in the child model list display displayed at the bottom of the parent model details screen.

Figure 16 Setting of external key linkage
  • Since the submodel is a subset of the main model,You can not make changes that change the table structure. Therefore, when defining a submodel, the following points defined in the main model areDo not change. (If changed, an error will occur at build time or at run time.)
    • Item ID
    • Item type
    • Add items to be "stored in database".(You can add automatic computed items that are not stored in the database and reference interlocking items etc to the submodel.)
    • For the settings of "relational database details", "mandatory check" etc. in the model item definition sheet, make definitions different from the main model (It is necessary to make same setting for both main model and sub model.)
  • It is not possible to define a submodel of a submodel.
  • When deletion of data with a submodel, be sure to prepare "model reference (check box)", "repeat item", "repeat container item" included in the main model also in the submodel.(If it is unnecessary in the submodel, it is good to make it a hidden item.If you do not do this, data deletion from the submodel fails.
  • When changing the item referred to by the model for the same item in the main model and the submodel, take care that the "reference" of the model reference destination is the same.
  • It is not possible to create a submodel of a system model (such as juser or jgroup).

Can I set a group authority different from the main model in the submodel?

Submodel is different from main modelGroup authorityIt is possible to set.

For example, you can say that the main model is authorization 3, submodel 1 is authorization 2, and submodel 2 is authorization 3.

Although the mandatory check of the item is the specification to make it the same for the main model and the submodel, can you change "warning" between the main model and the submodel?

For essential checks, three types of values ​​can be set: "○", "warning" and "unspecified" in the specified place.When "○" is set NOT NULL constraint is set in the corresponding column in the database table definition.Therefore, if "○" is specified for any of the models, "○" must also be specified for other models in the main sub relation.This is for using the same table.

Warnings and unspecified can be combined.For example, it becomes as follows.

Settable combination

Main modelSubmodel
warningwarning
(Unspecified)warning
warning(Unspecified)
(Unspecified)(Unspecified)

Combinations that can not be set

Main modelSubmodel
warning
(Unspecified)
warning
(Unspecified)