Support > Repository > Initial value > Basic writing style
ja | en

Specify the timing and value in the initial value setting field of the item.

Initial value can be set for each item.Specify the screen, type of value, specific setting value.

Fig. 1 Initial value setting field

Screen designation

The timing of initial value setting on each screen is as follows.

timing Description
When registering screen is displayed When you click the "Register screen" button, the initial value is set in the new registration screen.
At registration In the new registration screen, the initial value is set at the timing of registering data (when "Save" button is clicked).The database stores the value specified as the initial value regardless of the input on the new registration screen.
On update In the update screen, the initial value is set at the timing of data update (when the "Save" button is clicked).Regardless of the input on the update screen, the database stores the value specified as the initial value.
When displaying detailed screen The initial value is set immediately before the detailed screen is displayed.On the detail screen, regardless of the value stored in the database, it is displayed with the initial value set.

(Note that this setting is reflected even immediately after opening the update screen.)
When search screen is displayed The initial value is set in the search condition item on the search screen.When range search is specified, the initial value is set to the lower limit item (left side of "~") of the search condition.
When search screen is displayed
(Upper limit item of range search)
When range search is specified on the search screen, the initial value is set to the upper limit item (right side of "~") of the search condition.
When searching Set the initial value at the timing of retrieving data from the search screen.When range search is specified, it becomes the initial value of the lower limit item (left side of "~") of the search condition.
When searching
(Upper limit item of range search)
Set the initial value at the timing of retrieving data from the search screen.When range search is specified, it becomes the initial value of the upper limit item (right side of "~") of the search condition.

Type specification

The types of initial values ​​that can be specified are as follows.

type Description
(Default) It is the type of this model item.(String, number, date ...)
String (random) It can be used when the model item is a character string.(More ...)
Logon ID It can be used when the model item is a character string.(More ...)
Group membership (in preparation)
Four arithmetic operations Use the formula to set the value.The item name is replaced by the Wagby rule.functionYou can also use.
Java code Embed Java code directly.It will be the code equivalent to the right side of the assignment.

When using a function, be sure to specify "arithmetic operation".If you forget this you will get a compile error.

Figure 2 Setting when using functions

Registration/Detail/Search screen display

It is processed in the following order.

  1. Setting the initial value
  2. Resolving model reference relations
  3. Automatic calculation

Therefore, the initial value can be applied to the automatic calculation formula.Conversely, you can not set the value after the reference relation or the automatic calculation result as the initial value.

We will respond to these needs by creating additional codes.For details on creating additional code, see "Wagby Developer NetworkIt is summarized in.

When registering/updating

At "registration time" and "when updating", the timing of setting the initial value isJust before saving in the database.

Therefore, even if automatic calculation is applied to items for which initial values ​​are specified, or even when values ​​are set for CSV upload updates, these values ​​will eventually beOverwrite by initial valueIt will be.

When model reference items are used in calculation formulas, these are "DB savedPlease say that.

If you use "DB not saved" in the expression, the integer type item is set to 0 and the string type item is set to blank.

REQUEST and SESSION functions, You can receive parameters from a separate screen (or another system) and set them as initial values.

This notation is assumed to be used in the case of posting to Wagby from a Web form prepared on a system different from Wagby (eg form prepared in PHP, Perl, etc.).