3.3 Data Types

Each field that you can enter data into expects a particular type of data. When you exit a field (for example, by pressing the RETURN key), form checks the contents of the field to be sure that the field contains the correct type of data. If a field does not contain valid data, form displays an appropriate error message and repositions the cursor at the beginning of the field containing the erroneous entry.

The formatting rules can be changed system-wide by the system administrator, and the form designer can change the rules on an individual field. The formatting rules described here are for the U.S. default formatting set. See Chapter 13, Formatting Data Values for more information on formatting sets.

Boolean

Some fields simply require a true/false, or yes/no, value. These are referred to as boolean fields, and will only accept the following input:

Table 3-2                          

Value
  Acceptable Entries           

yes y or yes                        

no  n or no                         

When you exit the field, form converts any upper-case input to lower-case, and fills in the full word if a valid single-character response (e.g., y or n) was given in an empty field.

Character

Character data may be used in such places as name or address fields. Any standard ASCII character may be typed into a character field, e.g., A-Z, a-z, 0-9, !@#$%&*()_+~-='[]{};':",./<>? , etc. See Chapter 4, Creating RMSfiles for more information about the character data type.

Date

Date fields must have valid dates (in various formats) entered into them. The allowable formats are:

MM/DD/YY DD/MON/YY

MM/DD/YYYY DD/MON/YYYY

MM-DD-YY DD-MON-YY

MM-DD-YYYY DD-MON-YYYY

MM.DD.YY DD.MON.YY

MM.DD.YYYY DD.MON.YYYY

MMDDYY DDMONYY

MMDDYYYY DDMONYYYY

In these formats, MM represents the two digit month, DD the two-digit day, and YY and YYYY represent the year, in two and four-digit formats, respectively. The characters MON represent the alphabetic abbreviation for the month (e.g., Jan, Feb, Mar, etc.). If the YY year format is used, the date is assumed to be in the 1900's. Any date between January 1, 1800 and December 31, 2099 may be entered. If the date was not entered using the date format that contains slashes, the date will be reformatted in the MM/DD/YY or MM/DD/YYYY format.

Integer

Integers are one of the three types of numeric entry allowed. This type of field may only contain digits that may only be preceded by a leading minus sign, if so required. Commas may be inserted, but they are removed when the field is exited. Integers may not, however, contain decimal points, or decimal places. On 'exiting' the field, the entry will be right-justified.

Money

The second numeric data type allowed is for money values. A decimal point is used in the standard way to separate dollars from cents. If no decimal point is entered, two decimal places are assumed. Following this rule, both 10.00 and 1000 may be entered for ten dollars. A money value may have more than two decimal places. If you desire to enter fractions of a penny, then the decimal point must be entered in its proper place. A money value may have up to 15 digits, in addition to the decimal point and commas. When you 'exit' a field containing a money value, the entry will be right-justified, and commas will be inserted if the number is larger than 999.99. However, no dollar-sign ($) will be displayed.

Real

The last type of numeric entry, real, may contain both commas and decimal places. The decimal places, however, are not required. This data type may also contain up to 15 digits, plus commas and a decimal point. When the field is 'exited', the entry will be right-justified, and, if the number is greater than or equal to 1000, commas will be inserted in their appropriate places.

String

String fields are similar to character fields. Their differences are discussed fully in Chapter 4, Creating RMSfiles. You may treat them identically when entering data into a data entry form, however. (Note: any standard ASCII character may be typed into such a field, e.g., A-Z, a-z, 0-9, !@#$%&*()_+~-='[]{};':",./<>? , etc.)

Time

Several valid formats may be used to enter data in a time-type field. The valid formats are:

HH HHam HHpm

HH:MM HH:MMam HH:MMpm

HH:MM:SS HH:MM:SSam HH:MM:SSpm

HHMM HHMMSS

In these formats, HH represents hours, MM represents minutes, and SS represents seconds. A time entered in these formats is assumed to be in 24-hour time, i.e., the hours go from 0 (midnight) to 23 (11 P.M.), unless it is followed by am or pm. When the field is 'exited' the time entered is converted to the HH:MM:SS format. For example, 1200 becomes 12:00:00, 1pm is converted to 13:00:00, and 1am to 01:00:00. You should also note that, when entering a time in the format HHMM, the leading zero may be omitted from the hour portion of the entry if the time is before 10:00:00.