web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

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

Business Central – How to Add More Buckets to Aged Accounts Receivable Report Extension

(3) ShareShare
ReportReport
Posted on by 30
 
Hello
 
I am desperately looking for some help here.  ,  I have tried using the code suggested in another question  to add additional buckets and the below is the code . I also tried to edit the layout to include the additional fields please see attached . However the report is not populating the additional buckets (Aged91To120 & Aged121Plus fields). If this is not the right approach what would be the work around.
 
Thanks in advance 
reportextension 50100 "Aged AR Ext2" extends "Aged Accounts Receivable"
{
    dataset
    {
        add(Customer)
        {
            column(Aged91To120; CalculateAgedAmount(Customer, 91, 120))
            {
            }
            column(Aged121Plus; CalculateAgedAmount(Customer, 121, 99999))
            {
            }
        }
    }
 
    local procedure CalculateAgedAmount(
        CustRec: Record Customer;
        FromDays: Integer;
        ToDays: Integer
    ): Decimal
    var
        CustLedgerEntry: Record "Cust. Ledger Entry";
        DueDate: Date;
        AgedAmount: Decimal;
    begin
        AgedAmount := 0;
 
        CustLedgerEntry.SetCurrentKey("Customer No.", Open, "Due Date");
        CustLedgerEntry.SetRange("Customer No.", CustRec."No.");
        CustLedgerEntry.SetRange(Open, true);
 
        if CustLedgerEntry.FindSet() then
            repeat
                DueDate := CustLedgerEntry."Due Date";
                if DueDate <> 0D then
                    if (DueDate <= (WorkDate - FromDays)) and
                       (DueDate > (WorkDate - ToDays)) then
                        AgedAmount += CustLedgerEntry."Amount (LCY)";
            until CustLedgerEntry.Next() = 0;
 
        exit(AgedAmount);
    end;
}
RDLC_DESIGN.JPG
 
I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    21,327 Super User 2025 Season 2 on at
    To add extra aging buckets, you must create a custom report by copying the standard Aged Accounts Receivable report and adding the bucket logic in AL. A reportextension + RDLC change alone is not sufficient.
  • Suggested answer
    NAV_with_Narang Profile Picture
    2,310 Moderator on at
    Hi @RD-11011729-0 - The answer to your question lies in understanding how Microsoft creates buckets in this report. Your task is to copy paste the report and mimic the exact same logic with a slightly different date range filtering for your additional buckets. Your code as it is, won't work
  • RD-11011729-0 Profile Picture
    30 on at
    Hi, 
     
    Sorry I am not clear on this, please could you give a little more detail on the below statement please
     
    "First I think you should not add another data item and use existing once by understanding the source report code."
  • Suggested answer
    Dhiren Nagar Profile Picture
    1,034 on at
    Hi,
     
    I think there are multiple corrections required in your code.
     
    First I think you should not add another data item and use existing once by understanding the source report code.
     
    Also in your procedure you are not using CalcFields on Flowfields i.e. Amount (LCY). You will not get values in report if you do not use it.
     
    Regards,
    Dhiren.

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

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,572

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 789 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 693 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans