community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Small AL quiz

A quiz about AL code demonstrates how StrSubstNo formats decimal numbers with thousands separators in some regions, causing runtime errors in CalcDate date formulas. The post shows how to avoid this by using integers instead of decimals.

post The BC Docs Librarian

Natalie Karolak · 2025-11-13 · 259 words · about 1 min

Key points

  • StrSubstNo formats decimal numbers using Format(Number, 0), which adds thousands separators based on region settings
  • CalcDate requires date formulas without separators, so formatted decimals like ‘1,000D’ cause runtime errors
  • Using integers instead of decimals avoids the thousands separator issue
  • Region settings affect how numbers are formatted in AL code

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.

  • other “CalcDate”
  • other “StrSubstNo”
  • other “Round”
  • other “Format”

Heads up

  • gotcha: “Depending on your BC Region setting, formatted decimals receive a thousands separator”

Context

  • Features: CalcDate function, StrSubstNo function, number formatting, date formulas, region-specific formatting

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