Hello experts,
First of all I would like to mention that I am fairly new to Dynamics NAV.
So,
I have created an RTC Report from an existing Classic Client one using "Tools -> Create Layout Suggestion". I rearranged the layout (using Visual Studio) so it would look similar to the Classic Client's one and everything works fine, except for the fact that in the RTC version I get wrong results at the very end of the report where the Grand Totals show.
I did try to debug the report in Visual Studio on the server using the technique described by Microsoft on how to debug an RTC object (
http://msdn.microsoft.com/en-us/library/dd301071.aspx) and the amounts for the Grand Totals are calculated correctly. I also tried to add the field for one of the Grand Total's in a repeating row (not using any aggregate function, just the result from the Dataset where the grand total is stored) and progressively (that is row after row) I get the correct results. It's only in the end of the report, where the Grand Totals show, that I get the wrong numbers.
For more assistance, I have attached 2 images, one from the Classic Client Version and one from the RTC version to show you what exactly is shown:
Classic Client:RTC:
Just to make it clear, the Grand Totals' expressions simply use a sum aggregate function for each field in the dataset provided by the classic client (and they were added automatically during the "Create Layout Suggestion" procedure by Dynamics NAV).
An additional thing I've noticed is that the wrong result for example in the column "Debit" in "Previous Period Total" is actually the sum of the "Total for Customer Posting Group..." multiplied by 4 plus the first non-zero result in the records. That is, (2942.16 * 4) + 1959.1 = 13727.74 . If you notice, we have 8 records and only two of them are non-zero. I presume that it adds up the 2 non-zero values in an alternate manner each time it displays/calculates a record (so 4 times the 2942.16 result) and finally a ninth time (presumably when it displays/claclulates the "Total for Customer Posting Group...") adds the first non-zero value (1959.1) once more...
Finally, I also tried to remove the sum function from the expression of "Debit" in "Previous Period Total" and I get a zero as a result.
Thank you in advance for any assistance
Answers
mean wile check the values in dataset..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Try oprning the report design in the classic and check the valkue of the 'DataSetFieldName' property and check this is what you are picking up in the report layout.
Failing that try the about this report function of the help on the report preview and check the vlaue of the field and what the data is - this may point you in the correct area.
First of all, I would like to thank you all for your comments. I got a solution to the problem, but before I give my solution, I would like to say to AntHillMob that, as I already mentioned the DataSetFieldName was assigned (correctly) from the automatic creation of the layout, and as far as mohana_cse06's comment is concerned, the values in the dataset were correct (which I could check using Visual Studio to debug the report on Nav Server)...
Well, I still do not understand why I was getting the wrong results, but what I did was to simply use the same expression as in the "Total for Customer Posting Group..." Section and I got all the Grand Total results correctly.
Lesson 1, (re)learned... Never trust a fully automatic process, unless you know the system well.
Lesson 2, (re)learned... Think out of the box, humans can do that...