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

Page function SUM formula using calcsums

(0) ShareShare
ReportReport
Posted on by 3,420

Hi Guys

I have created a page that displays each sales order line and want to display the on-hand quantity of the sales order line warehouse. So created a function but the SUM formula for quantity is not working - below try to lookup item Ledger Entry table and get on hand qty:

   var
            OnHandLineWH: Decimal;
    begin
        vItemLedger.Reset;
        vItemLedger.SetRange("Item No.", Rec."No.");
        vItemLedger.SetRange("Location Code",Rec."Location Code");
        
        if vItemLedger.FindFirst() then
            OnHandLineWH := vItemLedger.CalcSums(Quantity);
        exit(OnHandLineWH);
    end;
  • Suggested answer
    JAngle Profile Picture
    161 on at

    You have to do calcsums as a single line and then the field is set with the value so you can then assign it to a variable so like this:

    vItemLedger.calcsums(quantity);

    OnHandLineWH := vItemLedger.quantity;

    Calcsums returns a Boolean value when used with a variable directly. Like above will get you the decimal

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

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 665 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 418 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 280 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans