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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Line Amount is not showing in the RDLC report

(4) ShareShare
ReportReport
Posted on by 234
Good day mates,
 
I'm trying to create a RDLC report in BC, when I try to run the report its not showing or calculaing the Total Amount (Total Line Amount from Purchase line),
 
But its calulated the quantity properly.
 
 
 
Help me to solve the issue.
 
Thanks in Advance,
 
Santhosh.
I have the same question (0)
  • Suggested answer
    RockwithNav Profile Picture
    8,846 Super User 2026 Season 1 on at
    Check the layout, maybe it's getting directly calculated within design inside Visual Studio.
  • Suggested answer
    OussamaSabbouh Profile Picture
    10,875 Super User 2026 Season 1 on at
    Hello Santhosh,
     
    Your total is calculated after the Vendor record is printed. So TotalAmount is still 0.
     
    Best: don’t total in AL → expose Line Amount and use Sum() in RDLC.
     
    Or move the total output to after Purchase Line processing (e.g. footer / OnPostDataItem).
     
     
    Quantity works because it’s grouped correctly; amount is a timing issue.
     
    Regards,
    Oussama Sabbouh
  • Santhosh Thangadurai Profile Picture
    234 on at
    Well Thank you @OussamaSabbouh but please have a look at this code its similer to the perivous code.
     
    But its work properly, even its calculated the totalsales (Total Line amount in sales line), But how??? why ?????
     
    report 50129 CustSaleLineHeaderItem
    {
        ApplicationArea = All;
        Caption = 'profitability per customer';
        UsageCategory = ReportsAndAnalysis;
        DefaultLayout = RDLC;
     
        RDLCLayout = '.alpackages\Practice.Reports\CustSalesLineItem.rdl';
     
        dataset
        {
            dataitem(Customer; Customer)
            {
                column(Customer_No_; "No.")
                {
                    Caption = 'Customer No.';
                }
                column(Cutomer_Name; Name)
                {
                    Caption = 'Customer Name.';
                }
     
                column(InventoryItem; InventoryItem)
                {
                    Caption = 'Inventory Item';
                }
                column(Non_InventoryItem; Non_InventoryItem)
                {
                    Caption = 'Non_Inventory Item';
                }
                column(ServiceItem; ServiceItem)
                {
                    Caption = 'Service Item';
                }
                column(TotalSales; TotalSales)
                {
                    Caption = 'Total Sales';
                }
                dataitem("Sales Header"; "Sales Header")
                {
                    DataItemLink = "Sell-to Customer No." = field("No.");
     
                    dataitem("Sales Line"; "Sales Line")
                    {
                        DataItemLink = "Document No." = field("No.");
     
                        trigger OnAfterGetRecord()
                        var
                            ItemRec: Record Item;
                        begin
                            if Type = Type::Item then
                                if ItemRec.get("No.") then begin
                                    case ItemRec.Type of
                                        ItemRec.Type::Inventory:
                                            InventoryItem += "Line Amount";
     
                                        ItemRec.Type::"Non-Inventory":
                                            Non_InventoryItem += "Line Amount";
     
                                        ItemRec.Type::Service:
                                            ServiceItem += "Line Amount";
                                    end;
                                    SetRange(Type, "Sales Line".Type::Item);
                                    TotalSales += "Line Amount";
                                end;
     
                        end;
                    }
                    trigger OnPreDataItem()
                    begin
                        if (StartingDate <> 0D) AND (EndingDate <> 0D) then
                            SetRange("Posting Date", StartingDate, EndingDate);
     
                    end;
                }
     
                trigger OnAfterGetRecord()
                begin
                    TotalSales := 0;
                    InventoryItem := 0;
                    Non_InventoryItem := 0;
                    ServiceItem := 0;
                end;
            }
        }
        requestpage
        {
            layout
            {
                area(Content)
                {
                    field(StartingDate; StartingDate)
                    {
                        Caption = 'Starting Date';
                        ApplicationArea = All;
                    }
                    field(EndingDate; EndingDate)
                    {
                        Caption = 'Ending Date';
                        ApplicationArea = All;
                    }
                }
            }
        }
        var
            TotalSales: Decimal;
            InventoryItem: Decimal;
            Non_InventoryItem: Decimal;
            ServiceItem: Decimal;
            StartingDate: Date;
            EndingDate: Date;
     
    }
  • Gerardo Rentería García Profile Picture
    25,545 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Understanding RDLC Reports in Business Central – Aardvark Labs

    Best Regards
    Gerardo

  • Verified answer
    Khushbu Rajvi. Profile Picture
    21,573 Super User 2026 Season 1 on at
    It works because TotalSales is accumulated while iterating Sales Lines, and in that report layout the value is printed in a footer/after-line scope. In the Purchase report, the total is being printed before lines are processed (header scope), so it shows 0.
    report 50129 CustSaleLineHeaderItem
    {
        ApplicationArea = All;
        Caption = 'Profitability per Customer';
        UsageCategory = ReportsAndAnalysis;
        DefaultLayout = RDLC;
        RDLCLayout = '.alpackages\Practice.Reports\CustSalesLineItem.rdl';
        dataset
        {
            dataitem(Customer; Customer)
            {
                column(Customer_No_; "No.")
                {
                    Caption = 'Customer No.';
                }
                column(Customer_Name; Name)
                {
                    Caption = 'Customer Name';
                }
                // Totals per customer (computed in AL variables)
                column(InventoryItemAmt; InventoryItem)
                {
                    Caption = 'Inventory Item';
                }
                column(NonInventoryItemAmt; Non_InventoryItem)
                {
                    Caption = 'Non-Inventory Item';
                }
                column(ServiceItemAmt; ServiceItem)
                {
                    Caption = 'Service Item';
                }
                column(TotalSalesAmt; TotalSales)
                {
                    Caption = 'Total Sales';
                }
                dataitem("Sales Header"; "Sales Header")
                {
                    DataItemLink = "Sell-to Customer No." = field("No.");
                    trigger OnPreDataItem()
                    begin
                        // Date filter on headers (posting date)
                        if (StartingDate <> 0D) and (EndingDate <> 0D) then
                            SetRange("Posting Date", StartingDate, EndingDate);
                    end;
                    dataitem("Sales Line"; "Sales Line")
                    {
                        DataItemLink = "Document No." = field("No.");
                        trigger OnPreDataItem()
                        begin
                            // Filter lines BEFORE iterating them
                            SetRange(Type, Type::Item);
                        end;
                        trigger OnAfterGetRecord()
                        var
                            ItemRec: Record Item;
                        begin
                            // Safety: for Type::Item, No. should be item no.
                            if ("No." = '') then
                                exit;
                            if not ItemRec.Get("No.") then
                                exit;
                            // Categorize by Item Type and add Line Amount
                            case ItemRec.Type of
                                ItemRec.Type::Inventory:
                                    InventoryItem += "Line Amount";
                                ItemRec.Type::"Non-Inventory":
                                    Non_InventoryItem += "Line Amount";
                                ItemRec.Type::Service:
                                    ServiceItem += "Line Amount";
                            end;
                            TotalSales += "Line Amount";
                        end;
                    }
                }
                trigger OnAfterGetRecord()
                begin
                    // Reset totals per customer (runs before processing child dataitems for this customer)
                    TotalSales := 0;
                    InventoryItem := 0;
                    Non_InventoryItem := 0;
                    ServiceItem := 0;
                end;
            }
        }
        requestpage
        {
            layout
            {
                area(Content)
                {
                    field(StartingDate; StartingDate)
                    {
                        Caption = 'Starting Date';
                        ApplicationArea = All;
                    }
                    field(EndingDate; EndingDate)
                    {
                        Caption = 'Ending Date';
                        ApplicationArea = All;
                    }
                }
            }
        }
        var
            TotalSales: Decimal;
            InventoryItem: Decimal;
            Non_InventoryItem: Decimal;
            ServiceItem: Decimal;
            StartingDate: Date;
            EndingDate: Date;
    }
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,161 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,046 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 932 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans