Support > Repository > Referencing other models > Narrow down choices by relationship between reference models
ja | en

If you decide the value of one model reference, you can narrow down the choices of other related model references.

Example of operation

As an example we will deal with the case of referring to the employee name of the employee model.If the number of employees referenced here is large, it becomes difficult to search from the list box.
Therefore, first select "department" and realize the narrowing down function of selecting "employee" belonging to that department.

The "sales representative" choice will change depending on "sales department".In Figure 1, the sales department is not selected.

Fig. 1 Salesperson's choices are not displayed unless sales department is decided

If the department in charge is "sales part", the person in charge belonging to the same department is displayed as a choice.

Figure 2 Selecting a sales part

Likewise, if the department in charge is "sales division", the person in charge belonging to the same department is displayed as a choice.

Figure 3 Selecting two sales departments

Used as a search condition

Both items can be used as a search condition.

Figure 4 Using sales department and sales representative items as search conditions

Definition method

We prepare three models "department" "employee" "customer".

Department model

In the "department" model, prepare the primary key "department ID" and "department name".

Figure 5 department model

Employee model

The "employee" model refers to the "department" model.(FIG. 6, FIG. 7)

Figure 6: Employee model definition

Figure 6 Related setting of department items in employee model

Customer model

The "customer" model refers to the department model as "sales department" and the employee model as "sales representative" respectively.(FIG. 7, FIG. 8, FIG. 9, FIG. 10)

Figure 7 Defining customer model
Figure 8 Related setting of sales department in customer model
Figure 9 Related setting of salesperson in customer model (1)
Figure 10 Related setting of salesperson in customer model (2)

The point of setting is "option> narrowing down item" in Fig.

  • It must be a model reference item prepared for this model.(Numbers, character strings, date types are not available.It is model reference.)
  • It must also be included in the referenced model (employee model in this case).

This setting is illustrated as follows.

Fig. 11 Setting image

Figure 12 shows an example where sales department department items are set as radio buttons and sales person items are set as list boxes.

Figure 12 Radio Button - Combination of List Box

Figure 13 shows an example of using sales department items as check boxes and sales person items as list boxes.

Figure 13 Check Box - Combination of List Box

If you select multiple check boxes, the number of items to narrow down also increases.(FIG. 14)

Figure 14 Check Box - Combination of List Boxes (2)

Figure 15 shows an example of using sales department items as list boxes and sales person items as check boxes. If the list box is not selected, the salesperson will not be displayed.

Figure 15 List Box - Combination of Check Boxes (1)

When you select Sales department, the checkbox choices are displayed.(Figure 16)

Figure 16 List Box - Combination of Check Boxes (2)

Figure 17 shows an example where sales department department items are set as radio buttons and sales person items are set as check boxes.

Figure 17 Radio Button - Check Box Combination

Figure 18 shows an example in which both the sales department item and the sales representative item are check boxes.

Figure 18 Check box - check box combination

How it works

In this function, all the narrowing-down source data is loaded into the memory once, and the condition judgment is carried out by the Java program.[About performance ...]

Unspecified pattern

In the following cases, it can not be specified as narrowing down item.

  • Items that are not model references (numeric type, string type, date type, etc.)
  • Model reference (search screen)
  • If the primary key of the referenced model of the specified item is a compound key

In this case, another narrowing-down setting "Narrow down choices by value of other items"please use.

Operation when the value of the narrowing source has changed

When the value of the narrowing source is changed (in the above example, the value of "sales department" is changed), the value selected as "sales representative" is cleared.

Suggest item

You can not narrow down to suggestion items.(Setting does not work.)

Narrow down between two or more items

This function performs refinement operation focusing on the relationship between two items. By applying this we can define a narrowing down between two or more items.

For example, you can define the relationship between "organization" and "affiliation", "affiliation" and "name" for the items "organization" "affiliation" and "name". At this time, if you select "Sales Department" for organization, "First Sales Department" "Second Sales Department" can be narrowed down to belonging. Furthermore, if you select "1st Sales Department", you can set so that "Tanaka" and "Sato" are narrowed down in the name.

At this time, please note that the organization is "head office", but belonging is blank and the name "Saito" can not be prepared. In this case, even if the organization is set as "sales department" and belonging is undecided, "Saito" will be displayed as a choice in the name column.Because the name is not narrowed down by "pair of organization and affiliation" but because it is narrowed down to "belonging" to the last.If belonging is undecided, "Saito" will be added to the choice in the name column no matter what the organization is.

In order to avoid this, prepare the affiliation of the dummy.For example, in the above example, you can solve it by preparing "(directly under the head office)" etc. as an affiliation to the organization "head office".

This function reads all the data of the narrowing-down source into the memory once and judges whether or not the condition matches one by one in the Java program.Therefore, it is unsuitable when large amount of narrowing source data.Please use the number narrowing down source ("sales department" in the above example) with a number (about several to dozens) enough to be displayed on the screen.

For example, although the list box is a list box, there are hundreds or more of them, which is a problem in the design that makes this a hidden item on the screen.in this case"Narrow down choices by value of other itemsPlease use the method.Since this is narrowed down by SQL, when dealing with a large amount of data, it operates faster than this method.

Narrowing does not work on the list display screen

When including the model reference item set to narrow down on the list display screen, it is necessary to include the narrowing items also in the list display.(Taking FIG. 10 as an example, if you include the "Salesperson" item in the list display, also include "sales department" as the narrowing item in the list display.)

Narrowing does not work on list update screen

  1. If you include the model reference item that has been narrowed down on the list maintenance screen, you also need to include the narrowing items in the list display.It is the same as above explanation ("Filter is not working on the list display screen").
  2. Please set "Input control> Common> Redraw screen when changing value" as narrowing item.Refine by screen redraw function.