TOPIC: DATA TYPES [ 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
TOPIC: DATA TYPES
Now that you have learned how to change the field attributes on a Field
Menu, the next step is to proceed through the rest of the Field Menus and
specify the simple field edits shown in Table 3-2 for the ORDER form.
However, while the choices for the Field Type have already been
described, the choices available for the Data Type have not. Before
making the changes shown in Table 3-2, read the following description of
the three data types available with FORMSPEC, which are character, date,
and numeric.
Character Data Types
If you specify CHAR as the data type, any sequence of characters that are
valid for the current native language can be entered in the field. No
validity checking is performed on the data. No arithmetic operations are
allowed on data of type character. The user can enter any characters in
a character field. Type CHAR is the default data type.
For example: $12.59, 3/15/75, **123**, zwxtn, or Jones are all
legitimate entries. If you want to restrict the type of data entered to
date formats or numeric data, you can use the appropriate date or numeric
type.
Action
If you will be using a native language other than NATIVE-3000 (standard
HP 3000 English), refer to Section 8 in the VPLUS/V Reference Manual for
information on Native Language Support.
Date Data Types
The data type you specify to ensure that a date is entered in a field in
a valid manner consists of three orders, as shown in Table 3-3. When you
specify one of the date orders as a data type, FORMSPEC checks that the
entered data is in the correct order. In addition, since there are a
number of ways commonly used to specify a date, FORMSPEC also checks that
the entered data is in a valid date format, as follows:
The month can be the three-letter abbreviation, such as DEC, the
integer, such as 12, or the complete spelling, such as DECEMBER.
The day must be a digit between 1 and 31.
The year can be entered as four digits, such as 1986, or as two, such
as 86.
Various separators, such as a hyphen (-), comma (,), blank, or slash
(/), are allowed between the month, day and year.
The valid date format is the same whether the date is in the order MDY,
DMY, or YMD, defined in Table 3-3.
Table 3-3. The Full Set of Date Data Types
---------------------------------------------------------------------------------------------
| | |
| Data Type | Description |
| | |
---------------------------------------------------------------------------------------------
| | |
| MDY | The date must be entered in the order: month, day, year. |
| | |
| DMY | The date must be entered in the order: day, month, year. |
| | |
| YMD | The date must be entered in the order: year, month, day. |
| | |
---------------------------------------------------------------------------------------------
For example, the following are all valid dates:
Table 3-4. Valid Dates
-----------------------------------------------------------------------------------------------
| | | |
| MDY | DMY | YMD |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| February 7, 1986 | 7 February 1986 | 1986, February 7 |
| | | |
| FEB 7 1986 | 7 FEB 1986 | 1986 FEB 7 |
| | | |
| 02/07/86 | 07/02/86 | 86/02/87 |
| | | |
| 2/7/86 | 7/2/86 | 86/2/7 |
| | | |
| 02-7-86 | 07-2-86 | 86-2-07 |
| | | |
| 2 7 86 | 7 2 86 | 86 2 7 |
| | | |
| 020786 | 070286 | 860207 |
| | | |
-----------------------------------------------------------------------------------------------
The following dates, however, would be detected as errors:
Table 3-5. Invalid Dates
------------------------------------------------------------------------------------------------
| | | | |
| MDY | DMY | YMD | Reason |
| | | | |
------------------------------------------------------------------------------------------------
| | | | |
| Febrary 7, 1986 | 7 Febrary 1986 | 1986, Febrary 7 | Misspelled |
| | | | |
| FEBR 7 1986 | 7 FEBR 1986 | 1986 FEBR 7 | Four letter abbreviation |
| | | | |
| 2786 | 7286 | 8627 | Must be a two-digit month, |
| | | | day when no separator |
| | | | |
------------------------------------------------------------------------------------------------
Numeric Data Types
The data type DIG is one of three numeric data types. It allows only
digits--no plus or minus sign, commas or decimal point. The full set of
numeric data types is shown in Table 3-6. The two other numeric data
types, NUM[n] and IMPn, are described in more detail later in this
section with the UPRICE and TPRICE fields.
Table 3-6. The Full Set of Numeric Data Types
---------------------------------------------------------------------------------------------
| | |
| Data Type | Description |
| | |
---------------------------------------------------------------------------------------------
| | |
| DIG | Only digits are allowed. |
| | |
| NUMn | Plus or minus sign, commas, and decimal point (no more than n decimal |
| | positions) are allowed. |
| | |
| NUM | Plus or minus sign and commas are allowed; the decimal point can |
| | appear anywhere in the field. |
| | |
| IMPn | Plus or minus sign, commas, and actual or implied decimal point (no |
| | more than n decimal positions) are allowed. |
| | |
---------------------------------------------------------------------------------------------
The data type NUM2 allows a number with up to two decimal positions and a
decimal point. This insures that values are entered in standard price
format, such as 10.95 or 579.50. It also allows integers such as 150 or
35 to be entered but interprets these as 150.00 and 35.00. Table 3-7,
below, shows how each data type interprets an entered value.
Where commas are allowed they must be placed correctly every three
positions to the left of the decimal point. A plus or minus sign, if
used, must precede the number.
A NUM[n] field allows the widest latitude in entered numbers. It differs
from the CHAR type mainly in that it allows numeric calculations and
checks for misplaced commas.
NUM0 and DIG fields are alike except that NUM0 fields allow commas, a
decimal point, and a plus or minus sign, whereas DIG fields do not.
Commas are more likely to cause errors in IMPn type fields, where n means
the number of decimal positions. This is because commas must be placed
correctly relative to an implied, rather than an actual, decimal point.
An example of implied decimal would be where the user enters the number
1,00000 and VPLUS/V interprets the number as 1,000.00. Refer to Table
3-7 for more examples.
Table 3-7. Comparison of Entered and Interpreted Values
----------------------------------------------------------------------------------------------------
| | |
| Entered Value | Interpreted Value (based on data type) |
| | |
----------------------------------------------------------------------------------------------------
| | | | | | |
| | NUM2 | IMP2 | NUM | NUMO | DIG |
| | | | | | |
| 10.95 | 10.95 | 10.95 | 10.95 | (error) | (error) |
| | | | | | |
| 1095 | 1095.00 | 10.95 | 1095 | 1095 | 1095 |
| | | | | | |
| 10.9 | 10.90 | 10.90 | 10.9 | (error) | (error) |
| | | | | | |
| 10.956 | (error) | (error) | 10.956 | (error) | (error) |
| | | | | | |
| -100 | -100.00 | -1.00 | -100 | -100 | (error) |
| | | | | | |
| -1,000 | 1,000.00 | (error) | 1,000 | 1,000 | (error) |
| | | | | | |
| 1,00000 | (error) | 1,000.00 | (error) | (error) | (error) |
| | | | | | |
----------------------------------------------------------------------------------------------------
Figure 3-8. The Field Menu for the Date Field
Figure 3-9. The Field Menu for the Name Field
MPE/iX 5.0 Documentation