The choice model is used to manage several to dozens of choices.

Items of "primary key", "content", "display priority", and "expiration date" are predefined as model items in the choice model. Developers can use this model definition as a template (template) to store the contents of choices.

Item name (Japanese) Item name (English) Item type role
Primary key id Numerical value
Primary key
Contents content String Words displayed on the screen
Display priority priority Numerical value Listing order of list boxes
expiration date valid String If any value is set, it is treated as invalid

Usually, these options arelist box,Radio button,CheckboxWe will use it in either method.

Here is an example of preparing a choice model for storing "industry type".

Figure 1 Creating a Choice Model
"Option model" "Option model (fixed initial data)" is used.In the case of "option model (fixed initial data)", options can not be changed during operation.Please use it when you do not plan to change such as gender flags.[More ...]

In the option model, four items "primary key" "contents" "display priority" "expiration date" are predefined as standard.
(You can not change the name and ID of these items.You can only change the primary key type.)

Figure 2 Standard form of choice model

Here, we will set the model name to "industry type" and model ID "jobtype_m".
("_ M" included the meaning that this model is an option, but it does not necessarily have to be such a name.)

Figure 3 Setting the model name and model ID

You can change the type of primary key only.You can select from "character string" "number" "date/time".Standard is a number.

Figure 4 Specification of type

The choice model can set the initial value specially.When you press the "Initial Data" tab, the input screen shown in Fig. 5 opens.

Figure 5 Setting initial values ​​of choices

By pressing "Add" button, you can set multiple initial values."No." in the left column is fixed (serial number), but this is only used for display, it is not stored in the database."ID" is the primary key.

Figure 6 Setting the initial value of the "content" item
Even after starting operation, you can add/change the value of choice.Detail is"Add options during operationI will explain it.

I will explain an example of referring to the business type added to the customer model.

The item name is "Industry Type".The item ID is "job".The type specifies "reference item of another model".

Figure 7 Setting Information of Industry Model Item

If you select "Refer to item of another model" as type, Figure 87 "Model item type detailed setting" dialog is displayed.

Fig. 8 Model type detailed setting

As the reference model, select the "industry type" model prepared in Figure 2.

Figure 9 Designation of reference model

Specify the input type as "list box".In the referenced model item, "content" is specified.

Figure 10 Specifying input type and referenced model item

Further options are set.In the display priority item, "display priority" prepared on the side of the choice model side is linked to "invalid judgment item", respectively.

Fig. 11 Designation of display priority items and invalidation judgment items
By default, "display priority" and "expiration date" are automatically set for items referring to the choice model.

Reference using list box

Check the application you built.The "Industry Type" item is displayed in the list box.Also, you can see that the initial data is loaded.(FIG. 12)

Figure 12 List box display

"(Not selected)" is automatically added in the choices.This is intended to be unselected.You can also remove "(not selected)".[More ...]

Reference with radio button

An example using a radio button is shown in Fig.

Fig. 13 Display by radio button

When using radio buttons, once you select something, you can not cancel all (no selection). Therefore, the eraser icon shown in Figure 14 is prepared.You can cancel all selections by pressing this icon.

Figure 14 Eraser function

Reference using check box

An example using the check box is shown in Fig.

Figure 15 Displayed by checkbox

You can select all the options at once.Please press the all check icon shown in Figure 16.

Figure 16 All check icon

After checking, the shape of the icon changes to an eraser.(FIG. 17)

Figure 17 Icon shape changed to eraser

By using the eraser function, you can cancel all selections at once.

Figure 18 When you hover the mouse over the icon, the description will pop up

The value of the choice can be added during operation.
Select the industry type model search screen.Click the Update List button.

Figure 19 Search screen of industry type model

On the list maintenance screen, you can edit data and register new data.

Figure 20 List of Industry Model Updates Screen

If you press the "New" button on an arbitrary line, an entry field is prepared on the bottom line.Enter a new option here and press the "save" button at the top of the screen.

Fig. 21 Add one business type data

Open the customer model new registration screen again.You can see that industry options are added.

Figure 22 Industry options added

You can change the display order of choices during operation.

Open up the list of industries again.Set a number in the "Display priority" column.This numberIn descending orderSorting is done.

Figure 23 Setting Display Priority

When opening the new registration screen of customer data, you can confirm that the choices are displayed in the specified order.

Figure 24 Options are sorted by display priority

Change display order

The standard is "descending (in ascending order of numbers)", but you can change this as an "ascending order (ascending numerical order)" rule.
(Ascending order is "1, 2, 3, ...", descending order means "10, 9, 8, ...".)

Figure 25 Setting display order

More on sorting rules

Display priority
Specify the item specified in "Display priority item".The type must be an integer type.
It is sorted by the primary key value of the choice model."Display priority item" is not used.
It is sorted according to the contents of the choice model.For string type, it is in dictionary order."Display priority item" is not used.
Fixed sort key of referenced model
(It can not be set with option model.)

Wagby does not allow you to delete options data.Since choices have the property that they are referred to from various models, inconsistency occurs because referenced data does not exist if deleted.Instead, you can override the choices.Here we explain how to do it.

I try to disable the choices during operation. Open up the list of industries again.In the "Expiration date" field, set any character.If characters are included here, the data will be invalid.

Figure 26 Setting the expiration date of data

Let's check the customer data referring to the option whose expiration date is set.As shown in Fig. 27, the mark "(-)" is displayed next to the option data.This means "I am referring to invalid (old) choice data now".

Figure 27 Displaying data referencing invalid alternatives

Let's update this customer data.In the column of industry type, a selectable list including current invalid data is displayed.

Figure 28 List of currently available choices

I will select a new type of business.

Figure 29 Selecting a New Industry

I will update the same data again.Then, you can see that data of industries that became invalid are no longer displayed in the option column.

Figure 30 Invalid data can not be selected

In Wagby like this, you can gradually replace invalid data (to valid data) while operating.

This actionlist box·Radio button·CheckboxIt corresponds to both."Search screenIt can not be used with the method.

Make date range for expiration date

An arbitrary character string can be specified for the expiration date, but it has special meaning in case of date format (yyyy/MM/dd).

Expiration date setting Judgment
2016/1/1-2016/12/31 Valid from January 1, 2016 to December 31, 2016.
Example: It is valid when today is 2016/7/1.It is invalid when today is January 1, 2017.
-2016/12/31 Valid through December 31, 2016.
Example: It is valid when today is 2016/7/1.It is invalid when today is January 1, 2017.
2016/1/1- Valid from January 1st 2016.
Example: It is valid when today is 2016/7/1.It is invalid when today is 2015/12/31.
2016/12/31 Valid only for 2016/12/31.
Example: Effective when today is 2016/12/31.It is invalid if it is a day other than that.
String "invalid" It becomes invalid.
String "valid" or "valid data" It becomes invalid.If it is not a date, it is judged invalid when the character string is set.
(Empty string) It becomes effective.

Example of operation

We are preparing settings to search for invalid data.In Fig. 31, "food" data of industry type model is invalid.

Figure 31 Industry Data

On the search screen of the customer model referring to this industry model, it is possible to search with invalid data "food".(FIG. 32)

Figure 32 On the customer search screen, invalid data can also be retrieved

Invalid data is not displayed on the new registration/update screen.(FIG. 33)

Figure 33 Invalid data can not be selected on the customer new registration screen

Definition method

Opens the detail definition dialog for the industry type field of the customer model.Ignore invalidity judgment item "in the search control tab is enabled.

Fig. 34 Ignoring invalidity judgment items

The side referring to the choice model (reference source model.For the item "customer" model in the above example), holds the ID value of the choice model.It is not a content part.

When you check the table on the database, you can see that the ID value is stored.

When a check box is used, a dedicated table is created to hold multiple selection values ​​(ID).

If you enable "Initial data fixed" in the choice model, you will not be able to change options during operation.In order to treat it as a fixed value, it does not create a table internally and it is managed in memory.

Fig. 35 Fixed as initial data

The following rules apply to this model.

  • Do not create tables.
  • Invalidate the cache.(Always use memory values)
  • The detail screen, registration screen, update screen, download screen, upload update screen, list update screen are not created.(You can not add, change, or delete values ​​in operation.)
  • In the list display screen, the search condition part is not displayed.It is always displayed as a list.
  • The initial value of the simultaneous display number of the list display screen is 100.Up to 100 data items are displayed on one screen.
Settings on Designer are ignored.The above rules are forcibly applied.
This setting can be used only with "option model".(It can not be used in a normal model.)

Design considerations

When this setting is made, all internal database operations are treated as invalid internally.It is not possible to add, update, or delete data while the system is running.Search can not be narrowed down by specifying the search condition and always acquires all data.

Therefore, it can not be combined with the following settings.

  • Foreign key
  • Main model or sub model
  • Full text search
  • Workflow
  • Optimistic lock
  • Calendar view, various views including summary view
  • Implicit condition
  • Group authority
  • Using the ID of this alternative model as a key, you can refer to items (contents, display priority etc.) of your model by referring to

For these restrictions, please use this setting only as initial data as option.

Operational notes

  • Items can not be added to the choice model.Likewise, it is not possible to delete prepared items.
  • You can not prepare "alternative model without table creation" in the sub database.