AutoFormatExpr Property
TOC
Collapse the table of content
Expand the table of content

AutoFormatExpr Property

Sets a C/AL expression that specifies how to format data.

  • Fields

  • Forms

  • Pages

  • Reports

  • Text boxes

The C/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 amounts that can be stated in a foreign currency.

When you use the AutoFormatType and AutoFormatExpr properties to format a field, a trigger called AutoFormatTranslate in code unit 1 is called. AutoFormatTranslate has ID 12 and takes two parameters: one from the AutoFormatType property and one from the AutoFormatExpr property. The AutoFormatType property contains an integer (0, 1, or 2) and the AutoFormatExpr property contains text (“ =LCY”).

These properties are used when you have an amount or a unit amount that you want to be able to display in another currency and these properties determine the number of decimals that will be displayed. For example, a sales order will use 2 decimals when the currency is defined as US dollar and 0 decimals when the currency is defined as IDR (Indonesian rupiah).

The settings for the AutoFormatType property and the AutoFormatExpr property depend on the type of data in the control or database field you need to format. There are three categories of data: amount, unit amount, and other types of data.

  • Amount - AutoFormatType must be 1 and AutoFormatExpr must return a currency code (the blank currency code denotes LCY) in order for data to be formatted as amount data.

  • Unit Amount - AutoFormatType must be 2 and AutoFormatExpr must return a currency code (the blank currency code denotes LCY) in order for data to be formatted as unit amount data.

  • Other - AutoFormatType must be 0 and AutoFormatExpr must be blank for data to be formatted using the default C/SIDE settings (Standard Format 0).

If the AutoFormatType property does not contain a value, the format specified in the DecimalPlaces Property will determine how the decimal is formatted in the table, report, or form. However, if you enter a value in the AutoFormatType property, it will override the value specified in the DecimalPlaces property and the AutoFormatType property will determine how the decimal is formatted in the table, report, or form. Furthermore, if you enter a value in the AutoFormatType property for a report or form, it will override the value entered in the DecimalPlaces property in the table and determine how the decimal is formatted in the report or form.

Community Additions

ADD
Show:
© 2016 Microsoft