HP 3000 Manuals

CONDITIONAL CALCULATIONS [ 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

CONDITIONAL CALCULATIONS 

When you press ENTER to record DISCNT_PERCNT, the menu for the next
field, DISCNT, is displayed, as shown in Figure 5-11.  The DISCNT field
illustrates a new statement.  In most cases, a discount is granted
conditionally.  In this exercise, you give the customer a discount only
if the total net value of the order is at least $1,000.  Such a discount
can be calculated automatically using the IF statement.  The IF statement
causes an operation to be performed only if a specified condition is
true.

Action 

First, set the field type of DISCNT to D for display-only and the data
type to NUM2.  Then, press FIELD TOGGLE and type the IF statement, as
shown in Figure 5-11; press ENTER.

Assuming that DISCNT_PERCNT is 10, DISCNT is set to 10 percent of any net
total equal to or greater than $1,000.  If the net total is less than
$1,000, the ELSE statement is executed to set DISCNT to 0.

[]
Figure 5-12. Field Menu for SUB in the TOTALS Form


MPE/iX 5.0 Documentation