forstner
1st June 2012, 11:45
Hello,

I have a strange problem. I have a report with the Layouts Before.report, Detail and After.report. In the After.report Layout i have 4 fields where i use the aggregate function (the domain is tc mcs.double and all field settings are the same). 3 of these fields show the correct sum, but one shows a false sum. The sum is almost twice of the amount it should be (but not exactly). Any ideas what the reason could be?

Thanks in advance!

mark_h
1st June 2012, 16:23
Just put the report in debug mode and step through it. But first - I would check that the data is getting to the report correctly. Make sure there is nothing in the report script that might impact the field. The run a small amount of data - check what gets read into the field and what happens as you step through the report.

günther
4th June 2012, 11:29
Also have a look at the field "Where (Expr)" right to the file "Aggregate Function". Maybe these differ.

Günther

forstner
4th June 2012, 12:24
Hi Mark,

Thank you. I found the problem:

sum.hrea.cost = sum.hrea * (ticpr150.wgrt + ticpr150.mcrt + ticpr150.ohrt)

aiu = sum.hrea.cost + mitmcost

if aiu = 0 and aiu.null = tcyesno.no then
lattr.print = false
endif

sum.hrea.cost, mitmcost and aiu have value 0 and sum.hrea not. Does that mean when lattr.print = false is used i have to set all values to 0 when i use the aggregate function? With other words the aggregate function will sum the value even the line is not printed?

mark_h
4th June 2012, 15:17
If I understand correctly then yes when you set lattr.print to false then yes you might need to set the variables to zero. Since I do not know the report or the script I can't be sure. Or as Gunther mentioned - maybe add a where clause to the aggregate itself.