AutoFormatExpression Property

Version: Available or changed with runtime version 1.0.

Sets an AL expression that specifies how to format data.

Applies to

  • Table Field
  • Page Field
  • Report Column

Syntax

AutoFormatExpression = '<Currency Code>';
AutoFormatType = 2;

Remarks

It applies to fields or columns of the decimal data type.

The AL expression is evaluated when the expression performs updates. Together with the AutoFormatType Property, this property determines how data is formatted. These two properties are only used to format decimal data types, such as amounts that can be stated in a foreign currencies or ratios.

For more information, see Formatting Decimal Values in Fields.

Example 1

The following example uses AutoFormatExpression property to set the format of decimal values to USD.

AutoFormatExpression = 'USD';
AutoFormatType = 1;

For example, this will result in a value like 7,564.00.

Changing the AutoFormatExpression property to ÌRD sets the format of decimal values to IDR (Indonesian rupiah).

AutoFormatExpression = 'IRD';
AutoFormatType = 1;

For example, this will result in a value like 7,564.

Example 2

The following example is similar to the previous example, except it adds a $ sign before the amount.

AutoFormatExpression = '1,USD';
AutoFormatType = 10;

For example, this will result in a value like $7,564.00.

Example 3

This example prefixes the decimal value with a $, includes a thousand separator, and has a maximum of two decimal places, such as $76,453.21:

AutoFormatType = 1;
AutoFormatExpression = '$<precision, 2:2><standard format, 0>':

See Also

AutoFormatType Property
DecimalPlaces Property