topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

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

Videos, posts and code changes

Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 3 Learn pages