web
You’re offline. This is a read only version of the page.
close
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;}
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    89,846 Super User 2025 Season 2 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

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans