Dynamics 365 Business Central: Reports and report extensions can no longer have dataitems whose names are only quotes and whitespace (e.g. “” and ” “)

Dynamics 365 Business Central

Hi, Readers.
Minor update 21.1 for Business Central 2022 release wave 2 has been released this month. Learn more: Link.
Today I would like to share a small update. Reports and report extensions can no longer have dataitems whose names are only quotes and whitespace (e.g. “” and ” “).

PS: This information is not mentioned in What’s new and planned for update 21.1, but is recorded in AL Language Changelog version 10.1 (AL Release Notes).

Let’s see an example, in BC20.0 (AL Language v10.0):

We can name the dataItem of reports and report extensions as quotes and whitespace (e.g. “” and ” “). Although I think very few developers do……

In this update (BC21, AL Language v10.1), Microsoft added a warning for this.

“The name of a dataitem cannot be empty because it can cause runtime errors. This warning will become an error when targeting a runtime with version ‘13.0’ or higher.”

PS: AL0753: As of now, the link is still 404 – Page not found.😑

My test code:

reportextension 50111 MyExtension extends "Standard Sales - Order Conf."
{
    dataset
    {
        addlast(Header)
        {
            dataitem(""; "Purchase Line")
            { }
            dataitem(" "; "Purchase Line")
            { }
        }
    }
    trigger OnPostReport()
    begin
        Message(""."No.");
        Message(" ".Description);
    end;
}

Give it a try!!!😁

PS:
1. Version ‘13.0’ should be Business Central 2024 release wave 1 (April 2024).

2. We can use a custom ruleset file to specify how code analysis will report the issues it encounters. For example, change this warning to error. More details: Ruleset for the Code Analysis Tool

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL