Format string

The Format Definition window allows you to specify a format string for string and composite data types.

String formats

Format strings are used with string data types to add static elements to a field, such as parentheses or static text. The Report Writer uses the capital X as a placeholder to represent alphanumeric characters that will appear in the field. All other characters will be displayed as you type them.

Example 1

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 on a report:

[spacer]

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 just as you typed them. Also note that a lowercase x is used in the “ext.” abbreviation in the second format string. Only uppercase Xs are treated as placeholders, 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.


Composite formats

A format string is used with a composite data type to indicate the size and order of the components of the composite, 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 just as you type them.

Not all composites use a format string. Some composite fields, such as the Microsoft Dynamics GP Account Number, have their format defined through program code.


Example 2

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.

[spacer]

Format string

Data entered

Data displayed

1111-22-3333

1000ND5050

1000-ND-5050


Note that the 1s, 2s, and 3s are used as placeholders.


Documentation Feedback