HP 3000 Manuals

TOPIC: DISPLAY-ONLY FIELDS [ USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide ] MPE/iX 5.0 Documentation


USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide

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 values
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 field,
or a constant value, or a calculated value to a destination field.  If
the destination or source is not specified, the value of the current
field, currentfield, is assumed.  The destination is always a field,
either a specified field name, the current field, or a save field name.
The source can be a field, a constant, an expression, or an index
retrieve operand.  Note that, unlike the edit statements, the various SET
statements cannot have a custom error message.

Constants in SET statements are specified just like constants in edit
statements; that is, a character constant is surrounded by quotes
("JONES"), a date constant by exclamation points (!February 20, 1986!),
and a numeric constant has no delimiters (12.35).  In every case, the
constant must be the same data type as the field to which it is being
moved.

Expressions are always numeric.  Expressions allow you to calculate
values based on the value of numeric fields and/or constants.
Expressions are very useful to calculate values and assign the result to
a display-only field.

Index retrieve operands consist of an index and a list of values, one of
which is selected based on the value of the index.

Action 

For a full discussion of the SET statement, refer to Section 4 of the
VPLUS/V Reference Manual.

The exercise used in this guide does not need index retrieve operands, so
their use is not fully depicted here.  However, since they can be useful
in many applications, you should be aware of them.  One particular
application is when you design a form to act as a menu, from which the
user selects the next form.  In such a case, an index retrieve operand
used with the CHANGE statement (see Section 7) can be very useful.  To
illustrate,

     CHANGE NFORM TO X OF FORMA, FORMB, FORMC, FORMD

Depending on the value of X, which can be assigned a numeric value as a
result of user entry on a menu form, the next form displayed is one of
the forms named in the list.

[]
Figure 5-6. Field Menu for ORDATE in the ORDER Form


MPE/iX 5.0 Documentation