community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Understanding ToText() in Business Central 2025

ToText(), new in Business Central 2025 Wave 1, turns values of many AL data types into text using a fixed default format with no formatting options, though date and time types take an optional boolean for invariant output. The post shows the results for decimal, big integer, integer, byte, boolean, date, time, datetime, duration, GUID and version, noting output mostly matches Format(value, 0, 0) and that it does not replace Format.

post Aardvark Labs

Marcel Chabot · 2025-04-25 · 1,095 words · about 5 min

"This is not a replacement for the Format method but provides a quick way to format a value for display."

Key points

  • ToText() is a quick display helper added in BC 2025 Wave 1 and is not a replacement for the Format method
  • Date, time, datetime and duration ToText() accept a boolean; the default is false, and true gives invariant output like Format(value, 0, 9)
  • Decimal ToText() keeps the full precision of the value, while a default Decimal field shows two decimals
  • Byte ToText() returns the integer value rather than the ASCII character, GUIDs lose their braces, and dates use two-digit month, day and year
  • A sample card page ARD_ToTextExample shows each type next to its ToText() result

Quotes

  • “This is not a replacement for the Format method but provides a quick way to format a value for display.” (Establishes the purpose and scope of ToText() as a convenience method rather than a full replacement for existing formatting approaches)
  • “The ToText() will function across the full precision of the value.” (Highlights a key difference from default field display, showing ToText() preserves decimal precision rather than truncating it)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

  • page “ARD_ToTextExample”

Not found in BC28-30: page “ARD_ToTextExample”.

Context

  • Features: ToText() method, decimal formatting, date formatting, time formatting, GUID formatting, boolean conversion, data type conversion
  • Versions: 2025 Wave 1

Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.