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...
Suggested Answer

How to sum up the Open quantity from Item Ledger Entries

(0) ShareShare
ReportReport
Posted on by 107

Hello My Community Family, Am developing a report which will show item variant by location from Item ledger Entry. I have added the Available quantity column to filter the 'OPEN' quantity. My problem is I want to sum the Quantity of similar items instead of generating multiple lines of the same item.

this is my code side

 dataset
    {
        dataitem("Item Ledger Entry"; "Item Ledger Entry")
        {
            RequestFilterFields = "Item No.", "Variant Code";
            DataItemTableView = where("Open" = filter(true), "Remaining Quantity" = filter(>= 0));
            column(Remaining_Quantity; "Remaining Quantity"{ }
            column(Location_Code; "Location Code"{ }
            dataitem("Item Variant"; "Item Variant")

            {
                DataItemLink = "Item No." = field("Item No.")Code = field("Variant Code");
                column(CodeCode) { }
                column(Description; Description{ }

            }
            trigger OnAfterGetRecord()
            begin
                // if "Location Code" = '' then
                //     CurrReport.Skip();
                // Loc.get("Location Code");

                if "Variant Code" = '' then
                    CurrReport.Skip();
            end;
        }
this is my output as we can see the same code but generating two-line instead of one line with a total of 150
pastedimage1645512867421v1.png
thank you guys for your assistance
  • Suggested answer
    JAngle Profile Picture
    159 on at

    Using a query to build the dataset or use the calcsums or calcfields function as the item table has a flow field giving you the result you want. You can pass a location and variant filter to it too

  • Maro9595 Profile Picture
    107 on at

    Hi Josh,

    Thank you for your response I have added the Calcsums on OnAfterGetRecord trigger as shown below

    trigger OnAfterGetRecord()

               begin

                   // if "Location Code" = '' then

                   //     CurrReport.Skip();

                   // Loc.get("Location Code");

                   "Item Ledger Entry".CalcSums("Remaining Quantity");

                   if "Variant Code" = '' then

                       CurrReport.Skip();

               end;

    but after publishing, I get two lines of the same data can you please guide me again on how to remain with only one line of data

    Thank you In Advance.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 719 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 410 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 369 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans