Sets the formats of the source expression for various data types.
Applies To
-
Dataport fields
-
Text boxes
-
XMLports
Remarks
You can set the Format property to a predefined format, or you can build your own format. For more information, see FORMAT Function (Code, Text).
Basic Settings
To choose a predefined format, use the syntax: <Standard Format,X>, where X is one of the entries in the Value column of the following table.
Value | Description |
---|---|
0 |
Standard Display Format (the default for all data types) |
1 |
Standard Display Format 2 (edit) |
2 |
C/AL Code Constant Format |
Note |
---|
You must enter the < and > angle brackets, such as <Standard Format,2>. |
Building Formats
You can use the Format property to create your own formats. To create a format, use the following rules:
-
A format property consists of zero or more Chars, Fields, or Attributes.
-
Fields and Attributes are expressed with an identifier inside brackets (<>).
-
Attributes must contain a comma (,) and a parameter after the identifier.
-
Fields can optionally take a comma (,) and a FieldLen.
The following table shows the syntax.
FormatProperty := |
[<Char> | <Field> | <Attribute>] |
|
|
<Char> := |
character with ASCII value [32..255] |
|
|
<Field> := |
'<' <FieldName> [',' <FieldLen>] '>' [, <Attribute>] |
<FieldName> := |
literal name of field (format component) |
<FieldLen> := |
length of field (0 or no entry means that the length is dynamic) |
|
|
<Attribute> := |
['<' <AttributeName> ',' <Char> '>'] |
<AttributeName> := |
[Standard Format | Filler | 1000Character | Comma | Overflow | Filler Character | Precision] |
Note |
---|
In the following table, a full stop is used as the decimal symbol. Filler and Filler Character indicate the character that is used to fill empty spaces. |
The FieldName is a component that you can use to build a format expression. Depending on the data type of the text box or dataport field, you can choose the appropriate FieldName from this list.
Data type | FieldName values |
---|---|
Decimal |
Sign, Integer, Decimals, Integer Thousand |
Date |
Day, Month, Month Text, Quarter, Year, Year4, Week, Week Year, Week Year4, Weekday, Weekday Text, Closing |
Time |
Hours24, Hours12, Minutes, Seconds, Thousands, AM/PM, Second dec |
DateTime |
Day, Month, Month Text, Quarter, Year, Year4, Week, Week Year, Week Year4, Weekday, Weekday Text, Hours24, Hours12, Minutes, Seconds, Thousands, AM/PM, Second dec |
Integer, BigInteger |
Sign, Integer, Integer Thousand |
Boolean |
Text, Number |
Option |
Text, Number |
Code |
Text |
Char |
Char/Number, Char, Number |
Text |
Text |
Example
The following examples demonstrate how to use the Format property:
-
Choosing a standard format.
Use the Standard Format attribute to select one of the standard formats (these are listed at the end of this Help topic).
For example, <Standard Format,5> selects Standard Format 5.
-
Using a standard format with an attribute.
<Precision,2:3><Standard Format,0> will use Standard Format 0 and will format the data with a minimum of 2 and a maximum of 3 decimal places. See also the DecimalPlaces Property. If you do not specify a precision, then the form uses the precision that is specified in the DecimalPlaces Property of the corresponding field in the table.
-
Building a format.
You can create your own formats using Chars (which are displayed literally), Fields (to choose specific components of a value, for example the year-part of a date) and Attributes (for example to select which character to use as a filler).
For example, a text box that is based on a source expression of the Date data type can use the following format string:
<Weekday Text>, <Month Text> <Day>
This expression displays the date as Monday, April 15.
Note The settings that are specified under the Regional and Language Options in Windows determine how some separators are displayed.
Standard Formats
The following tables list the predefined formats for each data type.
Decimal | Format | Example | ||
---|---|---|---|---|
<Sign><Integer Thousand><Decimals> |
0 |
-76,543.21 |
||
<Sign><Integer><Decimals> |
1 |
-76543.21 |
||
<Sign><Integer><Decimals>
|
2 |
-76543.21 |
||
<Integer Thousand><Decimals><Sign,1> |
3 |
76,543.21- |
||
<Integer><Decimals><Sign,1> |
4 |
76543.21- |
||
XML format |
9 |
-76543.21 |
For Dates, the Regional and Language Options in Windows is used to select the actual format that is used. The following table shows the fields that are used to build the various formats. This table corresponds to the Regional setting for a European country/region.
Date | Format | Example |
---|---|---|
<Closing><Day,2>-<Month,2>-<Year> |
0 |
05-04-03 |
<Closing><Day,2>-<Month,2>-<Year> |
1 |
05-04-03 |
<Day,2><Month,2><Year><Closing>D |
2 |
050403D |
<Closing><Year>-<Month,2>-<Day,2> |
3 |
03-04-05 |
<Closing><Day>. <Month Text> <Year4> |
4 |
5. April 2003 |
<Closing><Day,2><Month,2><Year> |
5 |
050403 |
<Closing><Year><Month,2><Day,2> |
6 |
030405 |
<Day,2><Filler Character, >. <Month Text,3> <Year4> |
7 |
5. Apr 2003 |
XML format |
9 |
2003-04-05 |
The following table shows how these formats will change if the Regional and Language Options is set to "United States."
US date | Format | Example |
---|---|---|
<Closing><Month,2>/<Day,2>/<Year> |
0 |
04/05/03 |
<Closing><Month,2>/<Day,2>/<Year> |
1 |
04/05/03 |
<Month,2><Day,2><Year><Closing>D |
2 |
040503D |
<Closing><Year>/<Month,2>/<Day,2> |
3 |
03/04/05 |
<Month Text> <Closing><Day>, <Year4> |
4 |
April 5, 2003 |
<Closing><Month,2><Day,2><Year> |
5 |
040503 |
<Closing><Year><Month,2><Day,2> |
6 |
030405 |
<Day,2><Filler Character, >. <Month Text,3> <Year4> |
7 |
5. Apr 2003 |
XML format |
9 |
2003-04-05 |
For Times, the Regional and Language Options in Windows are used to select the actual format used. The following table shows the fields that will be used to build the various formats. This table corresponds to the Regional setting for a European country/region.
Time | Format | Example |
---|---|---|
<Hours24>.<Minutes,2>.<Seconds,2> |
0 |
4.35.55 |
<Hours24>.<Minutes,2>.<Seconds,2><Second dec.> |
1 |
4.35.55.553 |
<Hours24,2><Filler Character,0><Minutes,2><Seconds,2> <Second dec.><Comma,.>T |
2 |
043555.553T |
XML format |
9 |
04.35.55.553Z |
The following table shows how these time formats will appear if the Regional setting is changed to "United States."
US time | Format | Example |
---|---|---|
<Hours12>:<Minutes,2>:<Seconds,2><Second dec.> <AM/PM> |
0 |
4:35:55 AM |
<Hours12>:<Minutes,2>:<Seconds,2><Second dec.> <AM/PM> |
1 |
4:35:55.553 AM |
<Hours24,2><Filler Character,0><Minutes,2><Seconds,2> <Second dec.><Comma,.>T |
2 |
043555 .553T |
XML format |
9 |
04:35:55.553Z |
The following table shows the fields that have been used to define the standard formats for DateTime. Note that the date, time, and decimal separators that are displayed are determined by the Regional and Language Options that have been selected on your computer.
DateTime | Format | Example |
---|---|---|
<Day,2>-<Month,2>-<Year> <Hours24>.<Minutes,2> |
0 |
05-04-03 4.35 |
<Day,2>-<Month,2>-<Year> <Hours24>.<Minutes,2>.<Seconds,2><Second dec> |
1 |
05-04-03 4.35.55.553 |
<Day,2>-<Month,2>-<Year> <Hours24>.<Minutes,2> |
2 |
05-04-03 4.35 |
<Day,2>-<Month,2>-<Year> <Hours24>.<Minutes,2>.<Seconds,2> |
3 |
05-04-03 4.35.55 |
XML format |
9 |
2003-04-05T03:35:55.553Z |
US DateTime | Format | Example |
---|---|---|
<Month,2>/<Day,2>/<Year> <Hours24,2>:<Minutes,2> <AM/PM> |
0 |
04/05/03 04:35 AM |
<Month,2>/<Day,2>/<Year> <Hours24,2>:<Minutes,2>:<Seconds,2><Second dec> <AM/PM> |
1 |
04/05/03 04:35:55.553 AM |
<Month,2>/<Day,2>/<Year> <Hours24,2>:<Minutes,2> <AM/PM> |
2 |
04/05/03 04:35 AM |
<Month,2>/<Day,2>/<Year> <Hours24,2>:<Minutes,2>:<Seconds,2> <AM/PM> |
3 |
04/05/03 04:35:55 AM |
XML format |
9 |
2003-04-05T03:35:55.553Z |
Integer and BigInteger | Format | Example |
---|---|---|
<Sign><Integer> |
0 |
-567 |
<Sign><Integer> |
1 |
-567 |
<Sign><Integer> |
2 |
-567 |
XML format |
9 |
-567 |
Boolean | Format | Example |
---|---|---|
<Text> |
0 |
Yes/No |
<Text> |
1 |
Yes/No |
<Number> |
2 |
1/0 |
XML format |
9 |
true/false |
Option | Format | Example |
---|---|---|
<Text> |
0 |
Blue |
<Text> |
1 |
Blue |
<Number> |
2 |
1 |
XML format |
9 |
1 |
Standard format 9 is used to display the data in the standard XML formats.
For Chars, all formats are: <Char/Number>.
For Text and Code, all formats are: <Text>.
See Also
© 2010 Microsoft Corporation. All rights reserved.