Total a column in a report

demi222
Member Posts: 131
For report 202 can someone help me on making totals? First of all I am having a difficult time understanding the dummy data items...
I want to total 4 columns in the Roundloop Body section.
One is the SalesLine.Quantity. The second one is SalesLine.LineDiscountAmount
and the third one is:
SalesLine.Amount Including VAT.
I know this is probably easy, but I have spent a lot of time trying to do this. I am new to programming and navision.
Can anyone help me?
I want to total 4 columns in the Roundloop Body section.
One is the SalesLine.Quantity. The second one is SalesLine.LineDiscountAmount
and the third one is:
SalesLine.Amount Including VAT.
I know this is probably easy, but I have spent a lot of time trying to do this. I am new to programming and navision.
Can anyone help me?
0
Comments
-
Hi,
To total fields in a report is relatively easy. You enter the fields in the TotalFields propery of a dataitem, and place textboxes with source expression to that fields in a footer section of that dataitem.
In your case, it is difficult because the Roundloop dataitem is an integer one.
All you have to do is create 3 decimal variables, make them zero on the OnPreDataItem of the Roundloop, and in the OnAfterGetRecord do the summing to that variables with code.
Then in a footer section of Roundloop place textboxes with source expression to that variables.
I took a look at the report and it is a bit complicated, make sure that the information you need isn't already calculated.
:-k0 -
ok, I made three global variables:
TotalQuantity
TotalDiscountAmount
TotalLineAmount
all of type decimal.
I added a roundloop footer and placed a textbox with source expression of TotalQuantity.
On Pre Data Item of Roundloop I set the variables to 0.
On After Get Record of roundloop the code I have added is:
IF "Sales Line".FIND THEN
TotalQuantity := "Sales Line".Quantity;
this, however gets the last record's quantity.
I then tried using "Sales Line".NEXT and this didn't work either.
I don't know how to sum them up.0 -
I got it!!
I should have done TotalQuantity := TotalQuantity + "Sales Line".Quantity.
Thanks for your help!!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions