Support > Repository > Check the input > User defined check
ja | en

You can perform original input check using arbitrary expressions. You can also write a message when an error occurs.

Figure 1 shows an example of an error when the "company name" item contains blanks.An error message is arbitrarily prepared.

Figure 1 Space Character Check
User defined checks are not done in real time.After the save button is pressed, it is checked on the server side.

In the detail definition dialog of the model item, write an expression and an error message in the user definition. It will be normal if the value of the expression is "true".When "false", an error message is displayed.

Item names are enclosed in placeholders $ {...}.Functions can also be used in expressions.

Figure 2 User-Defined Expressions
The expression describes "normal (permitted)" contents.If the value of the expression is true (true), no error message is displayed.

Warning will be displayed, but if you set the setting that you do not disturb the registration itself by pressing the save button here, specify "(warning)" option from the list box on the right side of the input column.

Figure 3 Specifying warnings

I want to itemize item 1 as a character string/date/time/date time type and I have not input yet.(Wagby'sRequired specificationDo not use)

NOT(ISBLANK(${item1}))

Item item 1 is numeric type and must be 0 or more.I want to determine whether it is a valid number, including not being uninputed.

${item1} >= 0

The item item 1 must contain numbers from "0" to "9".Otherwise an error will result.

ISINCLUDE(${item1},"0123456789")

The item item 3 must not contain a space.If it is included, it is an error.

NOT(ISINCLUDE(${item3}, " "))

Up to three checkbox items item 4 can be selected.If four or more are selected, an error occurs.

CHECKED(${item4})<=3

If the value of date-time type item sdate is 30 days or earlier than today, input can not be performed.

DATE (TODATE ($ {sdate}))> = DATE (TODAY ()), DATE (TODATE ($ {sdate})) + 30 <DATE

Since sdate is a date/time type, it converts it to the date type via the function TODATE.

When today is May 18, today and future dates, and before one month (before April 17) can be entered, but from April 18th to May 17th will be an error.

You can also make more complex input checks using scripts. For details, refer to "Business Logic> Input check/Consistency checkPlease read.

You can use the ERRORMESSAGE function in the message field.The argument is a resource key.

ERRORMESSAGE("E0001")

Edit myerrormsg_en.properties.UTF8

The error message corresponding to the resource key is described in "key = value" format in myerrormsg_en.properties.UTF8.Save this file in customize / resources.For details, refer to "Change / internationalize message> Edit resource filePlease read.

Resource files are compatible with internationalization.For English version, prepare myerrormsg_en.properties.

Here is an example of description.

E0001 = This data can not be registered.
E0002 = This data can not be registered because it is {0}.
E0003 = This data can not be {1} because it is {0}.

Here {0} and {1} are "Placeholders".The first argument of the ERRORMESSAGE function is a resource key (corresponding to E0001 in the above file), but after the second argumentFixed character stringYou can pass.

ERRORMESSAGE ("E0002", "Whitespace is included")
ERRORMESSAGE ("E0003", "Whitespace is included", "Register")
  • This check is performed on the server side at the timing of pressing the button such as "Save".
  • The input item that caused an error has a background of red.This applies to text input items or date/time list boxes.
  • It is not possible to check inputs for items that are not input targets.Specifically, it is an item which is obtained by calculation formulas, read-only item, reference linking item.
  • It is not possible to use aggregate processing functions such as COUNT, SUM, etc. for repetitive items, repeating containers, foreign key related models.
  • Other input checks are performed on the character string entered from the screen, but the check using this expression is the only item of "store model".(To be exact, after converting from a presentation model composed of character strings entered from the screen to a store model, the expression is applied to the value of that store model.For details of the store model and the presentation model, see "Business Logic> Model basicsPlease read.

How to check read-only items

As an example, prepare item a, item b, and item sum.
Here we assume an input check that sum = a + b has a relationship and that the value of sum must be 100.

In this case, you can not write an input check on the sum item side.
Wagby does not perform input check for read-only items (items which the user can not directly edit; automatic calculation items are also included in this).

When checking input to items which can not be directly edited by the user, it prevents the case where only data which always becomes an input error can be created.

Therefore, describe the expression on the side of item a.

It can also be described in item b.It will be the same behavior.

${sum}==100

The repository key is model/modelitem/generic_check.