Totalling an Integer Field

madm
Member Posts: 92
I am trying to add a total to a field which is classed as an integer.
the contents are 1
2
3
etc
i would like to calculate them to give total 6. From my understanding, as this is not a decimal field then i cannot calculate on it?
Is this correct, and if not, how would i go about adding a total field to the footer?
Thanks
the contents are 1
2
3
etc
i would like to calculate them to give total 6. From my understanding, as this is not a decimal field then i cannot calculate on it?
Is this correct, and if not, how would i go about adding a total field to the footer?
Thanks
0
Comments
-
The values are in some global variable or in some table you are using in the report?0
-
the field is actually in the table.0
-
I don't know why you have problem with totaling integer. It is same as totaling decimal... if the table is used as dataitem in the report, use the dataitem property TotalFields. If it is your variable, use CurrReport.CREATETOTALS(rec.field) to automatically create the totals...0
-
thanks for you prompt replies.
i think i was having a "bad" moment when i started the report.
I tried the totalfields method and got :
The fields specied in the TOTALFIELDS property must be of type decimal. The *field* in *table* is not a decimal.
I then went on to declare a variable and use totalamount := totalamount + *field*
however :oops: i used the pre, rather than the onafter record trigger which gave me zeros!
i have now corrected this, but the totals which im received are running totals. I have the report grouped, but the total for each group, is the total so far. (I am using a groupfooter)0 -
if you are using CreateTotals, the totals are calculated automatically - the report take the value of the variable on the end of OnAfterGetRecord and make the totals and subtotals as needed... you must not to use
totalamount := totalamount + *field*
you need only:OnPreDataItem Currreport.CREATETOTALS(TotalAmountVar); //or replace TotalAmountVar with *field* OnAfterGetRecord TotalAmountVar := *value* ; //or *field*
0 -
thanks alot - working now!
Youve been a great help
(although im on to my next problem now)
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