Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,537 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,520 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans