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

Notifications

Announcements

No record found.

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 105

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
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 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
    105 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

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 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans