There are two ways you can specify a value that form will automatically put into a field: a default value or an initial value.
You can specify a default value for a field by entering the value in the Default Value field in the Field Description Screen. Form copies the default value into the field when the cursor is in the field with the default value, the field is empty (contains blanks), and the operator presses the RETURN key. If the field is not empty, or the operator exits the field with a key other than RETURN, the field is not changed.
You can specify an initial value for a field by entering the value in the Initial Value field in the Field Description Screen. Form places the value you put in the Initial Value field on the Field Description Form into the field at these times:
When form displays a blank form (for example, after pressing the QUERY or ADD keys)
When form displays an entire form (for example, after pressing the FIND or UPDATE keys)
Note that when you UPDATE then STORE a form with an Initial Value field, the original value of the field will be replaced by the initial value. Also, when you press QUERY then FIND, only records matching fields with the initial value will be found, since the initial value is copied into the match fields.
The initial value or default value field may contain names that start with a $. Form substitutes the value into the initial value or default value string before using the field.
For example, if the name is set to Bruce, then the initial value string
This is $name
sets the field to the value
This is Bruce
An initial value or default value of TODAY is treated specially in DATE or TIME fields. The value TODAY is replaced with the current date or current time, respectively. This can be used in the default value field to give the current date or time. Note that if TODAY is used as an initial value, it participates in a QUERY, and only records with the current date or time is found.
Returning again to the subscription RMSfile example, assume that most of the subscriptions that are entered run for twelve months, so the Issues Left field is normally set to twelve when entering a new subscription. The Field Description form can be changed so the default value for that field is twelve. The modified Field Description form for the Issues Left field would appear as follows:
Now whenever the user types only the Return key in that field, the number 12 appears in the field.