Totalling fields on integer dataitems
rvilela
Member Posts: 10
Hi!
I am changing the purchase order report to group lines for the same item number, and show only one line per item (totalling the qty and line amount fields). I am new in developping in NAV, so I was able to sort the lines and the totals with the precious help you all gave here in other posts in the fórum.
So I have only one problem left... On the line that sums, either it sums the qty or the amount, can't sum them both! Apparently it only sums the one I put first on the code.
I have 2 decimal variables: FooterTotal and FooterTotalQ
I created a variable (PurchLine2), record for Purchase line table
I added this code to the OnAfterGetRecord (RoundLoop dataitem):
IF ShowFooter THEN
FooterTotalQ := 0;
FooterTotal := 0;
FooterTotalQ += PurchLine.Quantity;
FooterTotal += PurchLine.Amount;
ShowFooter := TRUE;
PurchLine2.COPY(PurchLine);
PurchLine2.GET(PurchLine."Document Type",PurchLine."Document No.",PurchLine."Line No.");
IF PurchLine.Type = PurchLine.Type::Item THEN
IF PurchLine2.NEXT <> 0 THEN
ShowFooter := (PurchLine2."No." <> PurchLine."No.");
Can you help me understand why the amount field doesn't sum?
Thanks a lot!
Rita
I am changing the purchase order report to group lines for the same item number, and show only one line per item (totalling the qty and line amount fields). I am new in developping in NAV, so I was able to sort the lines and the totals with the precious help you all gave here in other posts in the fórum.
So I have only one problem left... On the line that sums, either it sums the qty or the amount, can't sum them both! Apparently it only sums the one I put first on the code.
I have 2 decimal variables: FooterTotal and FooterTotalQ
I created a variable (PurchLine2), record for Purchase line table
I added this code to the OnAfterGetRecord (RoundLoop dataitem):
IF ShowFooter THEN
FooterTotalQ := 0;
FooterTotal := 0;
FooterTotalQ += PurchLine.Quantity;
FooterTotal += PurchLine.Amount;
ShowFooter := TRUE;
PurchLine2.COPY(PurchLine);
PurchLine2.GET(PurchLine."Document Type",PurchLine."Document No.",PurchLine."Line No.");
IF PurchLine.Type = PurchLine.Type::Item THEN
IF PurchLine2.NEXT <> 0 THEN
ShowFooter := (PurchLine2."No." <> PurchLine."No.");
Can you help me understand why the amount field doesn't sum?
Thanks a lot!
Rita
0
Answers
-
Hi, try changing the first part of your code in:
IF ShowFooter THEN BEGIN FooterTotalQ := 0; FooterTotal := 0; END;
* Daniele Rebussi * | * Rebu NAV Diary *0 -
Thank you soooooo much!

Best Regards
Rita0 -
-
Hi!
I'm so sorry for this question but... how do I do that? Don't know that option!
Thanks a lot!
best regards,
Rita0 -
1. Edit your first message
2. Find the field "Attribute", below the field "Subject"
3. Set this field to [Solved]
4. Submit your posting
* Daniele Rebussi * | * Rebu NAV Diary *0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
