Validation Range Definition [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Self-Paced Training Guide
Validation Range Definition
Validation ranges are implemented in much the same manner as validation
tables. The major difference is that while a range specifies the lower
and upper limits to be applied to the field, a table contains a number of
discrete values that can be entered in the field.
When a validation range is assigned to a field specification used on a
screen, HP ALLBASE/4GL automatically tests user input data against the
limits specified by the range. For any given range, the acceptable
values include the upper and lower limits, and all values between the
limits.
If the entered value is within the upper and lower limits, HP ALLBASE/4GL
displays the message associated with the range. Processing then
continues in accordance with the type of the message. If you don't
define a message in association with the range, HP ALLBASE/4GL displays a
system defined ERROR type message by default.
You can also use validation ranges to select records for reporting.
The validation ranges screen allows you to enter the range name, the
range itself, and any message to be displayed if the validation fails.
Menu Path
To access the validation ranges screen:
1. From the main menu select the Dictionary option.
2. Select the Validation Items option.
3. Choose Ranges.
Description
The range you define here validates the product number entered by the
user to ensure that it is a valid product number. Product numbers must
begin with the letters XY, and must have a four digit number following
the letters. This number cannot be lower than `1000'.
When you have defined the range, you must redefine the product_no field
specification to include the validation range. You will also need to
regenerate the product_scrn data screen to update the generated record
for the screen.
Validation Ranges Screen
To enter the field values:
Field Entry Explanation
---------------------------------------------------------------------------------------
Range Name product_no The name of the range within the
application.
Secured N Indicates whether this item is secured
against modification by an unauthorized
developer.
Edit Code U The standard edit code field indicating the
type of range checking to be performed.
This code is usually the same as the field
to which the range is assigned. If the
edit code is N or S then a numeric check is
performed. Otherwise the system collating
sequence is used. Refer to the HP
ALLBASE/4GL Developer Reference Manual for
more details.
Value - From XY1000 The lower limit of the range.
Value - To XY9999 The upper limit of the range.
Number of Decimal Leave blank. For numeric range checking this entry
Places specifies the precision to which the values
should be compared.
Message Name product_no_error The name of the message that is displayed
if the value entered by the user does not
fit within the specified limits.
To complete this validation range:
1. Press the Commit Data function key to create this validation
range.
2. When you have committed the range, include it in the field
specification by performing the following steps.
Action Explanation
------------------------------------------------------------------------------
Press Field Specs. This displays the field specification screen.
Enter product_no This is the name of the field specification that
has to be altered
Tab to the Range field This is the field where you enter the name of the
validation range.
Enter product_no This is the name of the validation range.
Press Commit Data This commits the changes to the field
specification.
To incorporate the new field specification and
table:
1. Go to the screen field details screen and call up the product_scrn
screen.
2. Call up field number 1.
You will see that the name of the validation range for the field
specification has been included automatically.
3. Press the Generate Screen function key to incorporate the new
field specification and table in the application.
To create the product_no_error message:
The last thing you need to do is to create the product_no_error message.
1. Go to the message definition screen.
If you haven't defined any other messages, tables, or ranges since
you defined the validation range, the message name should default
to product_no_error.
2. If the default is not product_no_error, enter the correct name.
3. Assign the message an ERROR type code and enter a message to
inform the user that the product number just entered is invalid.
4. Commit the message to generate it.
To check on the created messages:
1. Now test your application again and observe how the new items you
have defined work together in your application.
MPE/iX 5.0 Documentation