Getting Started with TRANSACT (32247-90007)
88 Chapter5
Automatic Error Handling and Prototyping
This version delays specifying whether a form is to be frozen or appended to another form
until the last possible moment. Recall that our goal is to first display a blank form for
entering global order information. If there are any errors in the data, then the form should
not be cleared, since that would require the user to re-enter all data.
Once the global information has been entered, then each line of the order is entered. If the
data is invalid, the form for that line should not be cleared, but left for correction of the
data.
Line 3.01 initially clears form vorderhead. Line 4 has been modified to capture the key
pressed by the user. If any of the function keys are pressed, it indicates that no more orders
are to be entered. Lines 4.1 to 4.7 perform this function and cause the program to end if the
user presses any of [[ F1 ]] through [[ F8 ]].
If the user presses [[ENTER]], Transact will continue to loop through lines 4 to 4.7 until
the data entered is valid. When this occurs, line 7.1 freezes the form on the screen so that
the forms to enter each order line will appear after this form.
Line 7.2 displays the first form for entering an order line after blanking it out. This is an
important step and gets us started in our order line data collection loop.
Line 9 is the important line within this loop. It specifies that we want to work with the
form currently displayed on the screen. This is also where the automatic error handling
will restart if Transact discovers any input errors. It is this line the prevents the problem
discussed in the previous example from happening; that is, it prevents automatic error
handling from putting a fresh form on the screen when it encountered data errors.
Lines 9.3 through 9.7 detect that the user has pressed any of [[ F1 ]] through [[ F8 ]] to
indicate that all lines have been added for the order. It reinitializes vorderhead and
terminates the level.
Lines 19 through 20 are reached after a valid order line has been added to the database.
They specify that the next form is to be appended to the screen and put a new blank form
on the screen so that the loop can be started again.
So far, we are only letting the automatic error handling detect the entering of non-numeric
data into a numeric field and trying to add an entry that is missing a master.
There are additional validation checks thatcan be handled automatically. The next version
of our prototype implements these checks.