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 :
Microsoft Dynamics NAV (Archived)

Ordered Qty

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

   I have 1 DataSource Table Item. Two other tables are Global SubContractHeader,Lines.

I want to get sum(orderedquantity) from SubContractHeader.

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Marcellus Profile Picture
    2,735 on at

    Hi Jsshivalik,

    Similarly to what I suggested to you here: community.dynamics.com/.../242407

    Try to a global variable for your TotalQty and add up the Quantities. Add the variable as a field to your dataset under the SubContractHeader data item.

    The other option is to create a group in RDLC for the SubContractHeader and use the some function within the scope of the group, so if your group is called "SubContractHeader" then you will total up like this: SUM(Fields!TotalQty.Value, "SubContractHeader").

    As I suggested before watch this video from Techdays 2015: Understanding Grouping in RDLC Reports from this you can learn how to create groups how to create totals with the groups you and a lot of other good things!

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     I have only 1 Data Item i.e Item Table. Others are defined as Global SubType Record.

    Thanks

  • Suggested answer
    Marcellus Profile Picture
    2,735 on at

    If you want to display the Quantity per Subcontract Header than you should add it as a dataitem, or you can do a loop on them using an integer data item.

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     Can u pls help me in detail. Secondly Item will not be linked directly with SubContract Header

    Thanks

  • Marcellus Profile Picture
    2,735 on at

    Hi,

    Could you please share your dataset?

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    How are you relating Item with SubcontractHeader and Lines, Why the Item was used as the DataItem, if you need the values from subcontractHeader ?  What is your report purpose ?

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     Below is the code OnItemAfterGetRecord . Item Table is the only DataItem. SLine is Global variable of Record SubType . Similarly the other 2 tables.

    OQty :=0;
    SQty := 0;
    
    rIle.RESET;
    rIle.SETCURRENTKEY("Item No.","Posting Date");
    rIle.SETRANGE("Item No.","No.");
    rIle.SETRANGE("Posting Date",0D,Date[1]-1);
    IF rIle.FINDFIRST THEN
     REPEAT
      OQty := OQty + rIle.Quantity;
    UNTIL rIle NEXT=0;
    
    
    SLine.RESET;
    SLine.SETCURRENTKEY("Document No.","No.");
    SLine.SETFILTER(SILine."No.",Item."No.");
    SLine.SETRANGE("Posting Date",Date[1] , AsDate);
    IF SLine.FINDFIRST THEN
     REPEAT
      IF SLine."Posting Date" = AsDate THEN BEGIN
        SQty := SQty + SLine.Quantity;
      END

    No_Item		AsDate	    Ordered Qty	Sale Qty Opening Qty
    FG171		02/06/2017		800       400
    FG172		02/06/2017		0          0
    FG173		02/06/2017		0          0
    FG174		02/06/2017		650       200
    


  • jsshivalik Profile Picture
    3,099 on at

    Hi

       If we have Item,Sale Order, Lines . I want to get Item Wise Total Ordered Qty & Total Sale.

    Thanks

  • jsshivalik Profile Picture
    3,099 on at

    Hi Marcell

    If u can tell me this scenario how it can be done then i think my problem will also be resolved

       If we have Item,Sale Order, Lines . I want to get Item Wise Total Ordered Qty & Total Sale.

    Thanks

  • Tina Menezes Profile Picture
    2,582 on at

    Hi Jsshivalik,

    You can define a variable 'TotalQty'. Now in OnAfterGetRecord() you can Setrange between 'No' of Sales Line record and 'No' field of Item table. So you will get the quantity from the sales line. Go on adding up the quantity for a particular item and save it in the 'TotalQty' variable which you have defined.

    I have written the code snippet for your understanding

    SalesLine.Reset,

    SalesLine.Setrange(No, ItemTable.No);

    If SalesLine.Findfirst then repeat

    TotalQty:=TotalQty+SalesLine.Quantity;

    Until SalesLine.Next=0;

    You need to put 'TotalQty' variable under your dataitem which you have defined in the report and display it in the report.

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 > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans