HP Data Entry and Forms Management System (VPLUS) Reference Manual (32209-90024)

Chapter 4 159
Advanced Forms Design
SET
value (see Table 4-7.).
By default, all fields are initialized to blanks in the initialization phase (refer to "Phases"
at end of this section for more information on phases.) You can specify a particular initial
value for any field by including an initial value in the Field Menu field attributes. More
elaborate initialization can be done with this subset of the SET statement.
When you assign an initial value to a field in the Field Menu, you can specify only a
constant. The constant is entered exactly like user input at a terminal. (Remember that
input in FORMSPEC is NATIVE-3000; if a native language is specified, data is converted
at run-time. Refer to Section 8.) When you assign a value through the SET statement, you
have more flexibility. The values assigned are dynamic in that they may depend on values
in other fields or in save fields, or they may be derived from an arithmetic expression, or
through an indexed retrieval. If you do assign a constant through the SET statement, it
must follow the rules for constants described earlier in this section. That is, a character
string must be surrounded by quotes, a date string by exclamation points. Also, a date
constant must be in the order MDY regardless of its destination format.
If a source field is of date type (MDY, YMD, DMY), the current field must be defined to be 8
bytes long to allow for internal delimiters. Some examples using the SET TO source
statement follow.
Example
1. Assume a date field of the form MDY.
SET TO $TODAY \Sets the field to today's date in the
\format dd/dd/dd in the order of
\the field's date type.
SET TO !FEB 10,1986! \Sets the field to the specified date.
SET TO DAT1 \Sets the field to whatever value
\is in the field DAT1 at run-time.
2. Assume the current field is type DIG. The following statement sets this field to a digit
selected from a list of digits by the index value, COUNT:
SET TO COUNT OF 7,9,16,24,31,72,15,12
If COUNT=5, the value assigned to the field is 31, if COUNT=3, the value 16 is assigned,
and so forth.
3. Values may be passed from one form to another through save fields. Assume that when
FORMA is executed, the save field SF3 is set to the value of F1. Further assume you are
designing FORMB and want to set the current field to the value of the field F1 in FORMA.
SET TO SF3 \Value passed from a field in a different
\form through the save field SF3.
Moving Data Between Fields
To move data to a field or a save field from another field or save field, or to move a constant,
an arithmetic expression, or a value retrieved from a list to a particular field, use the
following versions of the SET statement: