The Format Definition window allows you to specify a format string for the string and composite data types you create.
Format strings are used with string data types to add static elements to a field, such as parentheses or static text. Dexterity uses the capital X as a place holder to represent alphanumeric characters that will appear in the field. All other characters will be displayed as they are typed.
For instance, suppose you’re using a specific data type to store information entered in phone number fields. This Phone_Number data type uses a format and a format string to determine how phone numbers will appear at runtime:
Format string |
Data entered |
Data displayed |
---|---|---|
(XXX) XXX-XXXX |
7015550100 |
(701) 555-0100 |
ext. XXXX |
6590 |
ext. 6590 |
The Xs are placeholders indicating where the digits will be displayed, while the parentheses and dash are displayed as they were typed. At runtime, the phone number can be entered with the format string displaying the special characters in the field.
Also note that a lowercase x is used in the “ext.” abbreviation in the second format string. Only uppercase Xs are treated as place holders, so the lowercase x is displayed in the field, instead of being replaced when data is entered.
Static characters in a format string aren’t actually stored with the data in the table. This allows you to change the format string without affecting how data is stored. |
A format string is used with a standard composite data type to indicate the size and order of the components, and to add static elements, such as parentheses or static text. The numeric characters 1 through 9 are used to represent the characters of each component of the composite. All other characters will be displayed as they are typed.
A format string is used with an extended composite data type to specify a “starting” format for the composite. The final format for the composite will be specified using script commands. This is described in Composites.
The following example shows the use of a format for a standard composite. A composite must have a format and a format string. This composite contains three parts, as indicated by the format string.
Format string |
Data entered |
Data displayed |
---|---|---|
1111-22-3333 |
1000ND5050 |
1000-ND-5050 |
Note that the 1s, 2s and 3s are used as placeholders.