Creating a Report with CALCFIELDS

Hi Folks, I need some advice with a report I am writing. I am reading the Item Ledger Entry file and using the Property GroupTotals on the Item No. field to produce a report of sales for each item in a given month. I realise that I have to use the CALCFIELDS for Cost Amount (Actual) and Sales Amount (Actual) but when I run the report I only get the values for the last entry for a given Item No. I have the code (CALCFIELDS) in the GroupFooter section of the report. Am I doing this in the wrong place, if so where should it be as its driving me mad [:(!] trying to get it to work properly… Thanks…Paul

Better put CALCFIELDS in the “OnAfterGetRecord”-trigger of its dataitem.

Hi Alain, thanks for the help. I tried this and YES!!! it worked [:D]. Thanks for your help, I’d have been stuck on this for ages if its wasnt for your help, thanks a million…Paul

As Alain said, the problem is where you put the calcfields: Grouptotal will add the values on the variable/field you set to total for each iteration of the dataitem. If your calcfields is in the group total section, then your values are always 0, so their sum is also 0 all the time, but when you finally calculate it (just once) in the group’s total.