Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

AL Excel Report Displaying Null values for Prod. Orders without Comments

(2) ShareShare
ReportReport
Posted on by 10
Hello All, 

I am working on an AL report that is working with the Production Order table and Prod. Order Comment Line table. I have linked these 2 tables together by Prod. Order No. For any production order a comment does not exist the excel report outputs a NULL value. I understand why it would output a NULL value but I want to replace the value with blank or another value. I have tried the following methods to remove NULL:

1.  Within Dataitem(/Prod. Order Comment Line/; /Prod. Order Comment Line/) I have added
Trigger OnAfterGetRecord()
Begin
       if Comment = '' then
             Comment := ''
end;
I have changed that around a lot adding a space in Comment := ' ' or I tried if Comment = 'NULL'. This method did not seem to work
 
2. I then tried Conditional Formatting on the layout file but when you download the report from BC and look at the formatting, it shows No Condition Set.
 Layout File
 
After Download
 
Any help would be appreciated. If it changes anything, we are on the cloud version of BC. Here is my report code:
report 51001 /Work Center Report/{    ApplicationArea = All;    Caption = 'Work Center Report';    UsageCategory = ReportsAndAnalysis;    DefaultLayout = Excel;    ExcelLayout = './Layout/WorkCenterReport.xlsx';    //RDLCLayout = './Layout/WorkCenterReport.RDLC';    UseRequestPage = true;    dataset    {        dataitem(/Production Order/; /Production Order/)        {            DataItemTableView = sorting(/Due Date/, Status) where(Status = const(Released));            column(Prod_Order; /No./)            {            }            column(Item_No; /Source No./)            {            }            column(Description; Description)            {            }            column(Qty; Quantity)            {            }            column(Due_Date; /Due Date/)            {            }            column(Work_Center_No; /Work Center No/)            {            }            dataitem(/Prod. Order Comment Line/; /Prod. Order Comment Line/)            {                DataItemLink = /Prod. Order No./ = field(/No./);                column(Comment; Comment)                {                }                trigger OnAfterGetRecord()                begin                    if Comment = '' then                        Comment := ' ' // Set comment to empty if the record is empty                end;            }        }    }    trigger OnPreReport()    begin        Codeunit.Run(51003); // Run the /Status Logic/ codeunit    end;}
  • Suggested answer
    YUN ZHU Profile Picture
    86,083 Super User 2025 Season 1 on at
    AL Excel Report Displaying Null values for Prod. Orders without Comments
    As far as I know this is standard behavior. For example, the following standard report,
     
    But you can create a column on the Excel layout to show empty when the value is null, I think this would solve the problem.
     
    Hope this helps.
    Thanks.
    ZHU
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans