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).
![](https://yzhums.com/wp-content/uploads/2022/11/image-210-1024x821.png)
Let’s see an example, in BC20.0 (AL Language v10.0):
![](https://yzhums.com/wp-content/uploads/2022/11/image-200-1024x545.png)
We can name the dataItem of reports and report extensions as quotes and whitespace (e.g. “” and ” “). Although I think very few developers do……
![](https://yzhums.com/wp-content/uploads/2022/11/image-201-1024x545.png)
In this update (BC21, AL Language v10.1), Microsoft added a warning for this.
![](https://yzhums.com/wp-content/uploads/2022/11/image-202-1024x281.png)
“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.”
![](https://yzhums.com/wp-content/uploads/2022/11/image-203-1024x434.png)
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).
![](https://yzhums.com/wp-content/uploads/2022/11/image-204.png)
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
![](https://yzhums.com/wp-content/uploads/2022/11/image-205.png)
![](https://yzhums.com/wp-content/uploads/2022/11/image-208-1024x279.png)
![](https://yzhums.com/wp-content/uploads/2022/11/image-207-1024x351.png)
![](https://yzhums.com/wp-content/uploads/2022/11/image-209-1024x428.png)
END
Hope this will help.
Thanks for reading.
ZHU
コメント