Using VPLUS: An Introduction to Forms Design (32209-90004)
5-7
| Tax Rate | tr | 14|4|
| ||||
| Tax | tax | 14 | 10 |
| ||||
| Shipping | ship | 16 | 10 |
| ||||
| Total | total | 19 | 10 |
| ||||
| Customer Name | name | 22 | 42 |
| ||||
---------------------------------------------------------------------------------------------
TOPIC: DISPLAY-ONLY FIELDS
Now that the new form, TOTALS, is defined, you establish display-only
fields in both forms. A display-only field is one in which data is
generated by VPLUS/V or the application rather than entered by the user.
Display-only fields are protected so the user cannot enter or modify
data
in these fields.
The first field to be made display-only is the date. Since the date in
the ORDER form must always be today's date (edit statement EQ $TODAY),
you prevent potential user error by having VPLUS/V calculate this date.
Similarly, you specify in FORMSPEC that the date in the TOTALS form is to
be calculated by VPLUS/V.
You also change to display-only the fields that the user should not be
able to change because the totals are calculated by ENTRY. In the first
form, ORDER, there is only one totals field, the TPRICE field. Instead
of having the user calculate and then enter this value, VPLUS/V can
calculate the value by multiplying the user-entered values QTY and
UPRICE. In the second form, TOTALS, there are several fields whose val-
ues
can be calculated from other values in the form. These fields are:
DISCOUNT, TAX, and TOTAL. The obvious advantage of having VPLUS/V
calculate and enter values in such fields is that arithmetic errors are
avoided, and the data is entered more quickly.
To change a field to display-only, locate the Field Menu for the field
and then change the field type (FType) to D for display-only. This
specification prevents the user from entering data in the field, and
allows the field to be assigned a value by VPLUS/V or the application.
This value can be assigned directly, be calculated, or be moved from
another field or from a save field. This section discusses directly
assigned and calculated values. (Refer to Section 6 for values
transferred from other fields, or through save fields, from other
forms).
The SET statement can be specified in any of the three formats:
SET
destination
TO
source
SET
destination
SET [
currentfield
] TO
source
This statement basically moves a value from a
source
that can be a