A mask is a field formatting property that determines the pattern of data entered into a field and controls the type of data allowed. A typical example is an invoice number, which is usually a combination of letters and numbers in a set order. An appropriate mask helps data in-putters follow the convention defined by the mask. Masks are used in conjunction with the Character field type (see Character).
There are three default masks provided with Ability. These are:
###-##-#### (Social Security Number) e.g. 456-23-9847
(###) ###-#### [####] (Phone) e.g. (447) 756-1252 [4589]
#####-#### (Zip Code) e.g. 67845-6564
To choose one of these when formatting the field (see step 3 of Creating fields in a database), click on the arrow at the side of the Mask box on the Format page of the "Format Field" dialog.
You can, however, create your own masks, using the following codes to determine whether to allow numbers, letters, other characters, or combinations of any of these:
# (number)
& (all standard keyboard characters)
A (numbers and upper and lower case letters)
? (lower or upper case letter)
U (upper case letter)
L (lower case letter)
All of these can be left blank when filling in the mask. The mask can be formatted to contain, between the codes, any characters that are not in the above list, for example, . , ; : ( ) [ ] { } / \ < > a b c 1 2 3 and all the other characters on your keyboard except for #, &, A, ?, U, L.
Example
You can create a mask that will take invoice numbers of this form:
(ABC)-[12345 a]
Type the following in the Mask box of the "Format Field" dialog when formatting the field (see step 3 of Creating fields in a database):
(UUU)-[##### L]
Note that the two types of bracket, the hyphen, and the space, constitute the basic structure of the mask. U will accept upper case letters, # numbers, and L lower case letters. If you try to enter data not allowed by the mask you will not be allowed to proceed.