{"title":"AutoFormatExpression Property","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/properties/devenv-autoformatexpression-property/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-autoformatexpression-property, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-autoformatexpression-property","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Sets an AL expression that specifies how to format data.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Applies to","slug":"applies-to","at":117,"chars":54},{"level":2,"title":"Syntax","slug":"syntax","at":171,"chars":82},{"level":2,"title":"Remarks","slug":"remarks","at":253,"chars":438},{"level":2,"title":"Example 1","slug":"example-1","at":691,"chars":445},{"level":2,"title":"Example 2","slug":"example-2","at":1136,"chars":229},{"level":2,"title":"Example 3","slug":"example-3","at":1365,"chars":253},{"level":2,"title":"Example 4","slug":"example-4","at":1618,"chars":459},{"level":2,"title":"Related information","slug":"related-information","at":2077,"chars":145}],"text":"> Version: _Available or changed with runtime version 1.0._\nSets an AL expression that specifies how to format data.\n## Applies to\n Table field\n Page Field\n Report Column\n## Syntax\n```al\nAutoFormatExpression = '<Currency Code>';\nAutoFormatType = 2;\n```\n## Remarks\nApplies to fields or columns of the decimal data type.\nThe AL expression is evaluated when the expression performs updates. Together with the devenv-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.\nSee Formatting decimal values in fields<../devenv-format-field-data>.\n## Example 1\nThe following example uses AutoFormatExpression property to set the format of decimal values to USD.\n```al\nAutoFormatExpression = 'USD';\nAutoFormatType = 1;\n```\nThis example results in a value like `7,564.00`.\nChanging the AutoFormatExpression property to `ÌRD` sets the format of decimal values to IDR \\(Indonesian rupiah\\).\n```al\nAutoFormatExpression = 'IRD';\nAutoFormatType = 1;\n```\nThis example results in a value like `7,564`.\n## Example 2\nThe following example is similar to the previous example, except it adds a `$` sign before the amount.\n```al\nAutoFormatExpression = '1,USD';\nAutoFormatType = 10;\n```\nThis example results in a value like `$7,564.00`.\n## Example 3\nThis example prefixes the decimal value with a `$`, includes a thousand separator, and has a maximum of two decimal places, such as `$76,453.21`:\n```al\nAutoFormatType = 1;\nAutoFormatExpression = '$<precision, 2:2><standard format, 0>';\n```\n## Example 4\n> NOTE\n> > APPLIES TO: Business Central 2025 release wave 1 (v26) and later.\nThis example writes the number with two decimals, encloses the number in parenthesis if negative and 'Zero' if the value is `0`.\nThis uses the standard .NET numeric formatting system. See https://learn.microsoft.com/dotnet/standard/base-types/custom-numeric-format-strings.\n```al\nAutoFormatType = 1;\nAutoFormatExpression = '<FormatString>#,##0.00;(#,##0.00);Zero';\n```\n## Related information\ndevenv-autoformattype-property\ndevenv-decimalplaces-property\nFormatting values, dates, and time<../devenv-format-property>"}