4D v16.3Filter and format codes |
|||||||||||||||||
|
4D v16.3
Filter and format codes
Filter and format codes
Preliminary note: This section describes the characters used to set Alpha entry filters and display formats. The characters used for Number display formats are described in Display formats. An entry filter code has three parts, in this order:
For example, the following entry filter allows only the letters “a,” “b,” “c,” or “g” to be entered in two places: &"a;b;c;g"## In this example, the ampersand (&) is the initiator; the “a;b;c;g” is the argument; and the number signs (#) are the placeholders. The filter can be read as, “Allow the letters ‘a’, ‘b’, ‘c’, or ‘g’ in two places.” Thus the user may enter “ag,” “gc,” “ba,” “ab,” “aa,” “ac,” or any other combination of the four allowed characters. Entry filters can be combined. The following entry filter allows only the letters “a,” “b,” “c,” or “g” to be entered in two places, followed by the numbers 1, 3, or 8 in one place: &"a;b;c;g"#,#&"1;3;8"# The user must use two of the allowed letters, followed by one of the allowed numbers. A display format combines placeholders and standard characters. Two characters initiate a filter: the ampersand (&) and the tilde (~). These characters instruct 4D to use the argument that follows immediately as the filter for the subsequent placeholders. In addition, the tilde (~) also instructs 4D to make any letters uppercase. It does not prevent a lowercase letter from being typed; it simply changes it to an uppercase letter. Take a look at the following filters: &"P"# The difference between them is that the filter initiated with the ampersand (&) does not accept a lowercase “p.” The filter initiated with the tilde (~) accepts the lowercase “p” but converts it to uppercase. Because no letters are involved, the following entry filters are equivalent: &"1;5;8"# A filter argument follows the initiator and defines the characters that are allowed in the subsequent placeholders. To create a filter argument, surround the characters to be allowed with quotation marks. Arguments are made up of lowercase letters, uppercase letters, numbers, punctuation marks, and special characters (!@#$%^&*(){}[]":';?><,./`~). If you use a lowercase letter in the argument, only the lowercase form of the letter can be typed by the user. If you use an uppercase letter in the argument, only the uppercase form of the letter can be typed by the user.
The following table shows useful shorthand versions of arguments. They are used in filters without quotation marks:
The following entry filters are equivalent: &9# The following entry filters are equivalent: &a# The following entry filters are equivalent: &A# The number sign (#) is the only placeholder for Alpha filters and formats (other characters are available for Number filters and formats). You use one number sign for each character the user can enter in the field. For example, the following entry filter allows the user to enter letters in four places: &a#### The following entry filter allows the user to enter uppercase letters in three places, followed by numbers in two places: &A###&9## If you show no placeholders, the filter code allows any number of characters. The following entry filter allows the user to enter only numbers, but it does not limit the length of the entry: &9 Note: You can set the maximum number of characters allowed in an Alpha field in the Structure editor (see 4D field types). When a field with an entry filter is selected for data entry, 4D displays an underline (_) for each placeholder. As the user types a valid character, each underline is highlighted and replaced with the typed character. You can substitute any character for the underline. For example, if you display “XXXX” and the user types only two of the allowed characters (say they are “AA”), the field will contain “AAXX” when the record is saved. The following illustration shows a selected field displaying underlines and zeros. Any characters, punctuation marks, and spaces can be used as dead characters. Dead characters are displayed during data entry, but they are skipped over by the insertion point and are not entered as part of the data. The characters you want to use as dead characters are placed before, after, and between placeholders. They are displayed during data entry for clarity. The phone number entry filter (&9(###) ###-####) uses parentheses, a space, and a dash as dead characters. After you enter a digit immediately preceding a dead character, the insertion point moves directly to the first character following the dead character.
|
PROPERTIES
Product: 4D
HISTORY
ARTICLE USAGE
4D Design Reference ( 4D v16) |
|||||||||||||||