Skip to main content

Notifications

Community site session details

Community site session details

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

Date Format Change in AL in report extension

(1) ShareShare
ReportReport
Posted on by 16
I have a report extension that modifies "Standard Sales - Invoice" (1306). In this report, I have a few dates that are in the format June 17, 2024. I want this to be MM/DD/YYYY (06/17/2024) but I cannot find any documentation showing how this is done. I know it has to be done through AL but can anyone help me with how this is done exactly for the DocumentDate?
 
My current report extension code is bare and only has a custom table column so far:
 
reportextension 50100 MYSalesInvoice extends "Standard Sales - Invoice"
{
    dataset
    {
        add(Line)
        {
            column(Variant_Code; "Variant Code")
            {
 
            }
        }
    }
}
 
 
 
  • Suggested answer
    YUN ZHU Profile Picture
    81,360 Super User 2025 Season 1 on at
    Date Format Change in AL in report extension
    Hi, Just adding some information, if you need to change it into a format related to the region, it will be faster to use the following method.
    Dynamics 365 Business Central: How to quickly change the date format according to the language id in AL
     
    Thanks
    ZHU
  • Suggested answer
    gdrenteria Profile Picture
    17,490 Most Valuable Professional on at
  • Verified answer
    LB-02071434-0 Profile Picture
    16 on at
    Date Format Change in AL in report extension
    I figured it out! Leaving my code here for future reference in case someone else runs into this problem.
     
     
    What I did was create a new "column" in my report extension. I needed to update the "Document Date" and "Due Date" to both be MM/DD/YYYY format. I wanted to have the dates that are in the header of my invoice to be the ones used.
     
    reportextension 60100 GNASalesInvoice extends "Standard Sales - Invoice"
    {
        dataset
        {
            // The dates are want are located in my header. I add that as a dataset below.
            add(Header)
            {
                // I name the new header xml mappings what I want them to be, and add the formatting according to some      documentation I found.
                column("DocumentDate_mmddyyyy"; Format("Document Date", 0, '<Closing><Month,2>/<Day,2>/<Year>'))
                {
                }
                column("DueDate_mmddyyyy"; Format("Due Date", 0, '<Closing><Month,2>/<Day,2>/<Year>'))
                {
                }
            }
            add(Line)
            {
                column(Variant_Code; "Variant Code")
                {
     
                }
            }
        }
        // Be sure to render your report and add the word doc to the path in order to have your changes visible!
        rendering
        {
            layout(GNASalesInvoiceLayout)
            {
                Type = Word;
                Caption = 'Standard Sales - Invoice w/ Variant (Word)';
                Summary = 'Standard Sales - Invoice w/ Variant: Word';
                LayoutFile = 'src\Report Extensions\GNASalesInvoice.ReportExt.docx';
            }
        }
    }

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans