Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Business Central - Get sum of total quantity on sales order subform using AL

Posted on by Microsoft Employee

Hi, 

I wanted to get sum of qunatity from Sales Lines on sales Order Page. Thus, I created Page Extension.

pageextension 50102 SalesOrderLinesPage extends "Sales Order Subform"
{
    layout
    {
        addlast(Control45)
        {
            group("")
            {
                field("Total Quantity"; Quantity)
                {
                    ApplicationArea = Basic, Suite;
                    /*  AutoFormatExpression = "Currency Code";
                     AutoFormatType = 1; */
                    /* CaptionClass = DocumentTotals.GetTotalExclVATCaption(Currency.Code); */
                    Caption = 'Total Quantity';
                    DrillDown = false;
                    Editable = false;
                    ToolTip = 'Total Quantity field.';
                    trigger OnValidate()
                    var
                        TotalQty: Record "Sales Line";
                        decQty: Integer;
                    begin
                        TotalQty.Setrange("Location Code", "Location Code");
                        TotalQty.CalcSums(TotalQty.Quantity);
                        decQty := TotalQty.Quantity;
                        Rec."Quantity" := decQty;
                    end;


                }
            }
        }
    }

    actions
    {

    }

}
3835.Capture.PNG
I am not getting sum of all line item in Total Quantity field. Please anyone can assist me.
Thank you
  • Suggested answer
    Brian Wick Profile Picture
    Brian Wick on at
    RE: Business Central - Get sum of total quantity on sales order subform using AL

    Hello  - We currently do not have dedicated Dev support via the NAV/Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    https://mibuso.com/

    I will open this up to the community in case they have something to add.

    -Thanks

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans