Formatting values
Formatting values in AL covers how Business Central displays and converts data: the Format method for dates, times, decimals and other types, field-level decimal formatting properties, and file handling with text encodings. It answers questions about format strings, amount and currency display, and encoding choices for import and export.
Path: Development > Programming in the AL language > Formatting values · tier official · system development · narrative reviewed (checked by Opus)
Overview
This section groups three pages on how values are presented and exchanged in AL code. One page covers the Format method, which turns dates, times, datetimes, decimals, integers, booleans, enums and GUIDs into text using predefined or custom format strings. Another covers formatting decimal data in table, page and report fields through properties.
The third page deals with files and text encoding: opening, reading, writing and closing files, and which encoding to use when importing or exporting data so characters appear correctly across systems and languages.
Start with the Format method page for general text conversion. Use the field formatting page when the question is about how amounts, unit amounts or currencies appear in the UI or reports. Use the file handling page for import and export questions, including XMLports.
Key points
- The Format method supports dates, times, datetimes, decimals, integers, booleans, enums and GUIDs.
- Format accepts standard (predefined) formats or custom format strings with field names, attributes and syntax rules.
- Field formatting uses the AutoFormatType, AutoFormatExpression and DecimalPlaces properties.
- Field formatting controls amounts, unit amounts, currencies, thousand separators and precision; the page lists version 26.0.
- File handling covers opening, reading, writing and closing files.
- Encodings covered: MS-DOS, UTF-8, UTF-16 and Windows.
- XMLports are mentioned in the context of data import and export with encodings.
Learn pages
- File handling and text encoding: Understand how files are handled and text is encoded in Business Central.
- Formatting the data in a field: Learn how to format data in a field, either on the table level or on the page/report level.
- Formatting values, dates, and time: Learn how to format values, dates, and time in Business Central.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #10359 Add activity log amount formatting metadata (code change): “Amount fields in the Expense Activity Log Entry table now include currency-aware formatting metadata”
- Understanding ToText() in Business Central 2025 (community post): “ToText() is a quick display helper added in BC 2025 Wave 1”
- Format Cheatsheet (community post): “Format() supports 9 different format codes (0-7 and 9) that produce different output styles for the same data type”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.