Using VPLUS: An Introduction to Forms Design (32209-90004)
7-15
value for TPRICE is calculated and this value is added to the total value
for the order in STOTNET.
Figure 7-13. The Field Menu for ORDNUM
However, in order for the accumulation specified for TPRICE to work, you
must reset the value of STOTNET to zero at the beginning of each order.
In the first place, STOTNET must have an initial value for it to be used
in a calculation; and in the second place, you only want to store the
totals for a single order, not keep incrementing the value as the user
progresses from one order to another.
Action
Return to the Field Menu for the first field in the order, ORDNUM in
ORDER_HEAD, and add a statement to initialize STOTNET to zero, as shown
in Figure 7-13. Press ENTER.
The STOTNET save field is now cleared for each new order. Then, as
totals are calculated for individual order lines, STOTNET is increment-
ed.
Finally, in the initialization phase of the last form, ORDER_TOTALS, the
value accumulated into STOTNET is moved to TOTNET and displayed.
TOPIC: CHANGES TO ACCUMULATED VALUES
As specified so far, if the quantity or unit price of any order line is
changed in Browse mode, the changed value is added to the existing
accumulated value in STOTNET making the total incorrect. To illustrate,