Mask Style

Description

A mask is a specified pattern to which data must conform to be accepted, making data entry faster and more accurate. Use masks to validate and format data as it is entered into character fields. Masks are especially helpful when entering various types of codes or identification numbers such as telephone numbers, social security numbers, and invoice numbers into character fields. For example, if you track sales slips that always begin with a letter followed by three numbers, you might use the mask a### to ensure all entries start with a lowercase letter followed by three numbers.

Masks can also prevent users from entering the wrong kind of data. For example, a zip code mask could prevent users from entering letters instead of numbers. For example, you might always want telephone numbers entered with parenthesis around the area code, a space after the area code, and a hyphen after the first three numbers:

(617) 555-2924

The mask for this would be:

(000) 000-0000

Each "0" represents a number. The open and closing parenthesis, the space after the closing parenthesis, and the hyphen, are literal characters in the template that will be entered in the field during data entry.

You cannot apply a mask to a numeric field.

Creating a Mask

  1. In the Control Panel select the table and click Table > Edit Field Rules.

  2. Display the Field Types tab.

  3. Select a Mask Style. The options are:

    • "No mask" - the default

    • "Simple mask"

    • "Conditional masks" - You can define one or more conditional masks for a field. For example, you can define a different template and mask for each country. A U.S. ZIP code might be 01803-2801, while a Canadian postal code might be M5T 2T9.

  4. If you selected "Simple mask" in step 3:

    • 1. Optionally, enter a mask pattern into the Mask field. A mask is a pre-defined string containing mask characters and template characters. Mask characters accept data (see the Mask Character Table below); template characters are fixed and cannot be edited during data entry.

    • 2. Optionally, click the 'up' button to display the Input Mask dialog and select a predefined mask.

  5. Conditional Masks

    If you selected "Conditional masks" in step 3:

    • Enter a mask into the first row of the Mask column of the embedded browse.

    • Enter a condition expression into the first row of the Condition column. The condition must evaluate to TRUE (.T.) or FALSE (.F.). Click to use the Expression Builder to help you define the expression.

    • You may add up to fifteen additional expressions on subsequent rows of the embedded browse. During data entry, Alpha Anywhere evaluates conditional expressions in the order you enter them. It uses the mask of the first expression that evaluates to TRUE (.T.).

  6. Optionally, check Do not store mask literals in field. You may want to do this to shorten table fields and index entries. For a phone number field with the following template:

    (000) 000-0000
    • Values such as "(617) 555-1131" and "(617) 555-1097" are normally stored. With Do not store mask literals in field enabled, the values "6175551131" and "6175551097" are stored instead.

  7. Optionally, change the default Place Holder Character "_". This is the character that the user sees and which represents character positions that can accept input.

Mask Character Table

Use the following mask characters to define a mask.

Mask Character
Description
L

Any uppercase letter

l

Any letter

#

Any digit, sign or decimal

N

Any uppercase letter, digit, sign or decimal

n

Any letter, digit, sign or decimal

A

Any uppercase letter or digit

a

Any letter or digit

0

Any digit

&

Any character

\

Any character following \ is taken as a literal, or template character.

Automatically Advance to the Next Field

When entering data that completely fills a field, such as typing a 2-letter state abbreviation, you can automatically move to the next field without having to press ENTER. This saves time when entering large amounts of data. To set the field to advance automatically, click the Auto Advance after field filled check box.