AutoFormatExpression Property in Business Central – Wave 1 2025

With the release of Business Central 2025 Wave 1, Microsoft continues enhancing the AL language to make development cleaner, more flexible, and maintainable. One of the updates includes improvements around the AutoFormatExpression property — a property that may seem minor but plays a crucial role in controlling how data is displayed, especially in reports and pages.

In essence, the AutoFormatExpression property allows you to define a specific format for how numeric and date/time values are displayed in your Business Central application. This goes beyond the basic formatting options and provides granular control over aspects like decimal places, thousands separators, date and time patterns, and more.

What is the AutoFormatExpression Property?

The AutoFormatExpression property in AL is used to specify a formatting expression that overrides the default formatting behavior of a control. It works in conjunction with the AutoFormatType property and is typically used in pages and reports to control how numeric or date values are displayed.

For example, you might want to display a date in DD-MM-YYYY format instead of the system default, or format a decimal with specific currency or precision rules.

How Does AutoFormatExpression Work?

The AutoFormatExpression property accepts a string that defines the desired format. The syntax of this string follows specific rules depending on whether you are formatting numeric or date/time data.

For Numeric Data:

The expression can include placeholders for:

  • Decimal Places: Use # for optional digits and 0 for mandatory digits after the decimal point.
  • Thousands Separator: Typically a comma (,), but this can be influenced by regional settings.
  • Currency Symbol: The currency symbol is usually determined by the AutoFormatType and AutoFormatSubType properties.

Example:

  • #,##0.00: Displays numbers with two decimal places and thousands separators (e.g., 1,234.56).
  • 0.0: Displays numbers with one mandatory decimal place (e.g., 123.4).

For Date/Time Data:

The expression uses specific codes to represent different parts of the date and time:

  • Days: d (day of the month), dd (day of the month with leading zero), ddd (abbreviated day name), dddd (full day name).
  • Months: M (month number), MM (month number with leading zero), MMM (abbreviated month name), MMMM (full month name).
  • Years: yy (two-digit year), yyyy (four-digit year).
  • Hours: h (12-hour format), hh (12-hour format with leading zero), H (24-hour format), HH (24-hour format with leading zero).
  • Minutes: m (minutes), mm (minutes with leading zero).
  • Seconds: s (seconds), ss (seconds with leading zero).
  • Milliseconds: f, ff, fff (fractional seconds).
  • AM/PM: tt (AM/PM designator).
  • Time Separator: Typically a colon (:), but this can be influenced by regional settings.
  • Date Separator: Typically a slash (/), hyphen (-), or period (.), but this can be influenced by regional settings.

Examples:

  • MM/dd/yyyy: Displays date as month/day/year (e.g., 12/25/2025).
  • dd-MMM-yy hh:mm tt: Displays date and time with abbreviated month and 12-hour format (e.g., 25-Dec-25 06:36 PM).
  • dddd, MMMM dd, yyyy: Displays the full day, month, and year (e.g., Monday, December 25, 2025).
table AutformatTable
{
    fields
    {
        field(1; "Amount"; Decimal)
        {
            AutoFormatType = 10; // Currency
            AutoFormatExpression = "#,##0.00";
        }
        field(2; "Order Date"; Date)
        {
            AutoFormatExpression = "MM/dd/yyyy";
        }
        field(3; "Order Time"; Time)
        {
            AutoFormatExpression = "hh:mm:ss tt";
        }
    }
}

page AutoFormatPage
{
    layout
    {
        area(content)
        {
            group(GroupName)
            {
                field("Amount"; Rec.Amount)
                {
                    // Inherits AutoFormatExpression from the table field
                }
                field("Formatted Amount"; Rec.Amount)
                {
                    AutoFormatExpression = "0.##"; // Overrides table field format for this instance
                }
                field("Order Date"; Rec."Order Date")
                {
                    // Inherits AutoFormatExpression from the table field
                }
                field("Order Time"; Rec."Order Time")
                {
                    // Inherits AutoFormatExpression from the table field
                }
            }
        }
    }
}

Another example could be as follows

pageextension 50100 CustomerListExt extends "Customer List"
{
    layout
    {
        addlast(content)
        {
            field("Balance LCY"; Rec."Balance (LCY)")
            {
                ApplicationArea = All;
                AutoFormatType = 1;
                AutoFormatExpression = Rec."Currency Code";
            }
        }
    }
}

While AutoFormatExpression gives you precise control, be aware that regional settings can still influence aspects like decimal and thousands separators, as well as date and time formats if not explicitly defined.

The AutoFormatExpression property in Business Central Wave 1 2025 is a significant enhancement for developers looking to control the presentation of numeric and date/time data.

Stay tuned for more !!!

Using the New IncStr Overload in Business Central AL

With recent updates to AL language in Microsoft Dynamics 365 Business Central, developers now have more flexibility when working with strings containing numeric suffixes — thanks to the new overload of the IncStr method.

If you’ve ever had to increment a string with a number at the end (e.g., “INV001” to “INV002”), you’ve probably used IncStr. But until recently, IncStr only allowed an increment of +1.

Let’s explore how the new overload changes that.

🆕 What’s New in IncStr?

Traditionally, IncStr was used like this:

NewString := IncStr('INV001');  // Result: 'INV002'

Now, with the new overload, you can specify how much to increment by:

NewString := IncStr('INV001', 5);  // Result: 'INV006'

✅ Syntax:

IncStr(Value: String, IncrementBy: Integer): String

This enhancement is particularly useful in scenarios like:

  • Batch processing: Skipping ranges (e.g., test IDs, invoice numbers)
  • Custom logic: Implementing non-sequential numbering patterns
  • Looping identifiers: Where the next string isn’t always +1

⚙️ Example

LastCode := IncStr(LastCode, 5); // Jump by 5 in one go

🚧 Cases to Consider

  • It only increments the last numeric section of the string.
  • It respects the original number of digits (e.g., padding).
  • If there’s no number, it defaults to 1 and appends it.

IncStr('ABC', 3);  // Result: 'ABC3'

The new IncStr overload is a small change with big impact — making it easier to handle advanced string number incrementing without tedious code.

Stay Tuned for more.

Reopening Finished Production Orders in Business Central v26 (Wave 1 2025)

Microsoft Business Central is constantly evolving, bringing us new features and enhancements with each wave release. One highly anticipated addition in Wave 1 2025 (v26) is the ability to reopen finished production orders. This seemingly simple functionality addresses a long-standing pain point for many manufacturers, offering increased flexibility and control over their production processes.

The Challenge

Previously, once a production order was marked as “Finished,” it was essentially locked. Any necessary adjustments, corrections, or further processing required creating a new production order, leading to potential data discrepancies and cumbersome workarounds. This rigid approach often hindered efficient handling of rework, returns, or unexpected post-production requirements.

The Solution: Reopening Finished Orders

With the v26 update, Business Central introduces the capability to reopen finished production orders.

To reopen a production order, follow these steps:

  1. On the Finished Production Orders page, select the order you want to edit.
  2. Choose the Reopen action.
  3. In the Do you want to reopen the production order? confirmation dialog, choose Yes.

This empowers users to:

  • Correct Errors: If errors are discovered after finishing an order (e.g., incorrect quantity reporting, wrong item consumption), you can reopen the order, make the necessary adjustments, and re-finish it.
  • Handle Rework or Returns: If products need rework or are returned, you can reopen the finished order, register the required adjustments, and complete the rework process within the original order.
  • Add Post-Production Activities: If additional operations or processes are needed after the order is finished (e.g., special packaging, additional quality checks), you can reopen the order and register these activities.
  • Maintain Data Integrity: Reopening the original order ensures a consistent and accurate audit trail, preventing data fragmentation and improving reporting accuracy.

As we approach the release of Wave 1 2025, stay tuned for more detailed information and practical examples on how to leverage this valuable feature.