HP 3000 Manuals

CUSTOM ERROR MESSAGES [ 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

CUSTOM ERROR MESSAGES 

Whenever you specify a field edit, you should also provide a custom error
message to be issued by ENTRY when an entered value fails the field edit.
Otherwise, if a field fails the edit, a standard VPLUS/V message is
issued.  Since the standard messages cannot be informative for a
particular edit, each field edit should have a message that tells the
user exactly why the entered value is incorrect.  If an entered value
fails the edit, the custom message is issued instead of the standard date
type message.  In this exercise, you will specify a custom error message
for the ORDATE field.

Action 

Return to the Field Menu for ORDATE by pressing PREV until it is
displayed.  Then add a custom error message to the field edit, as shown
in Figure 4-10.  Press ENTER.

Whenever you want to continue the message onto another line of the Field
Menu, put quotation marks around the characters on each line and join the
two character strings with an ampersand (&).  For example:

     GE 1   "Enter quantity greater than" &
                " or equal to 1."

The message is displayed by ENTRY in the window line of the form as a
single line.

          Table 4-6.  Summary of Current Fields in the ORDER Form 
------------------------------------------------------------------------------------------------------
|          |                  |          |          |                                |               |
|  Field   |       Name       |  FType   |  DType   |   Processing Specifications    | Initial Value |
|   Num    |                  |          |          |                                |               |
|          |                  |          |          |                                |               |
------------------------------------------------------------------------------------------------------
|          |                  |          |          |                                |               |
|  8       | ORDNUM           | R        | CHAR     | --                             | 100000        |
|          |                  |          |          |                                |               |
|  1       | ORDATE           | R        | MDY      | EQ $TODAY                      | --            |
|          |                  |          |          |                                |               |
|  2       | NAME             | O        | CHAR     | --                             | --            |
|          |                  |          |          |                                |               |
|  3       | ADDRESS          | O        | CHAR     | --                             | --            |
|          |                  |          |          |                                |               |
|  4       | CITY             | O        | CHAR     | --                             | --            |
|          |                  |          |          |                                |               |
|  5       | ST               | O        | CHAR     | IN $STATE                      | --            |
|          |                  |          |          |                                |               |
|  6       | ZIP              | O        | CHAR     | MATCH ddddd[-dddd]             | --            |
|          |                  |          |          |                                |               |
|  7       | PHONE            | O        | CHAR     | MATCH [(ddd(]b*ddd-dddd        | --            |
|          |                  |          |          |                                |               |
|  9       | QTY              | R        | DIG      | GE 1                           | --            |
|          |                  |          |          |                                |               |
| 10       | PARTNUM          | R        | CHAR     | MATCH Puddd-???                | --            |
|          |                  |          |          |                                |               |
| 11       | DESCRIPTION      | O        | CHAR     | ------                         | --            |
|          |                  |          |          |                                |               |
| 12       | UPRICE           | R        | NUM2     |                                | --            |
|          |                  |          |          |                                |               |
| 13       | TPRICE           | R        | NUM2     |                                | --            |
|          |                  |          |          |                                |               |
------------------------------------------------------------------------------------------------------

The current fields in the ORDER form should now have the simple and full
edits as shown in Table 4-6.  In addition, the ORDATE field has a custom
error message.  Actually, every field edit should have a message
associated with it, which provides more helpful advice on how to correct
the error than the generic message can provide.

Action 

Proceed through the Field Menus adding custom messages to each field edit
statement.  Table 4-7 provides suggested messages for each field edit.

          Table 4-7.  Summary of Custom Error Messages 

-----------------------------------------------------------------------------------------------
|               |                              |                                              |
|  Field Name   |        Edit Statement        |                Custom Message                |
|               |                              |                                              |
-----------------------------------------------------------------------------------------------
|               |                              |                                              |
| ORDATE        | EQ $TODAY                    | Enter today's date in Month Day Year order.  |
|               |                              |                                              |
| ST            | IN $STATE                    | Enter the correct 2-character state code.    |
|               |                              |                                              |
| ZIP           | MATCH ddddd[-dddd]           | Enter ZIP code, must be either 5 digits or 9 |
|               |                              | digits and a hyphen.                         |
|               |                              |                                              |
| PHONE         | MATCH [(ddd)]b*ddd-dddd      | Enter phone number; any area code must be in |
|               |                              | parentheses; e.g., (408) 739-8809.           |
|               |                              |                                              |
| QTY           | GE 1                         | Enter quantity equal to or greater than 1.   |
|               |                              |                                              |
| PARTNUM       | MATCH Puddd-???              | First letter must be P, then letter A-Z, 3   |
|               |                              | digits, hyphen, 3 characters.                |
|               |                              |                                              |
-----------------------------------------------------------------------------------------------

[]
Figure 4-11. The Main Menu, Selecting Compile Once you have entered all the custom error messages, you are ready to compile the forms file. Action Press MAIN/RESUME to display the Main Menu. Type an X in the selection box to compile the forms file, as shown in Figure 4-11. Press ENTER. Unless the file is compiled, none of the new edits or error messages will be executed when the file is used with ENTRY. _________________________________________________________________ | | | :RUN ENTRY.PUB.SYS | | | | HP32209v.uu.ff ENTRY (C) HEWLETT-PACKARD CO. 1986 | | | | ENTER FORMS FILE NAME AND PRESS RETURN: ORDFORM1 | | ENTER BATCH FILE NAME AND PRESS RETURN: NEWDATA | _________________________________________________________________
[]
Figure 4-12. Run ENTRY; The ORDER Form, Batch Record No. 1


MPE/iX 5.0 Documentation