Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sums incorrectly

Status
Not open for further replies.

Kennymc

Programmer
Jun 4, 2003
35
US
I have a field I am trying to post a summary.

I have it reset to 0 in the groupheader1 Customer name
Group footer 2 has the formula
also have my calculation for openamt
whileprintingrecords
numbervar totalopenamt
totalopenamt := totalopenamt + openamt

in groupfooter 1 I have displaytotalopenamt
whileprintingrecords
numbervar totalopenamt

However when totalopenamt prints it doubles the last entry

ex
openamt 10 totalopenamt 10
openamt 12 totalopenamt 22
openamt 15 totalopenamt 37

group footer display totalopenamt 42 (15 is added twice)
It should show 37

Obvious mistake somewhere but can't seem to figure it out
 
What does this mean?

Group footer 2 has the formula
also have my calculation for openamt

What IS openamt? You have not declared it as a variable or told us what it is, if it is a calculation. Does your above statement mean you have a separate formula to calculate openamt?

-LB
 


I have it reset to 0 in the groupheader1 Customer name
Group footer 2 has the formula to track the running total
also has my calculation for @openamt

the formula
whileprintingrecords
numbervar totalopenamt
totalopenamt := totalopenamt + @openamt

in groupfooter 1 I have formula
displaytotalopenamt
whileprintingrecords
numbervar totalopenamt

However when totalopenamt prints it doubles the last entry

ex
openamt 10 totalopenamt 10
openamt 12 totalopenamt 22
openamt 15 totalopenamt 37

group footer formula displaytotalopenamt is 42 (15 is added twice)
It should show 37

Obvious mistake somewhere but can't seem to figure it out
Hope that makes it a little more clear
 
I was asking what the content is of {@openamt}--it might be relevant. Also, please note that 15 + 37 is 52, so that it doesn't look like the last value is simply being added again. There is nothing wrong with what you are doing on the surface, so I think it must have to do with your {@openamt} formula.

-LB
 
Hi,

I'm not sure what version of CR you are using, but you might want to try using Runnning Totals rather than using formulae with "whileprintingrecords" qualifiers. Running Totals were introduced with V8.0 (I think), and are much easier to manage than formulae with print run controls.

You still need to make sure you place them in the right places - always in the group footers rather than headers - as they are evaluated as the record print.

Derek.
 
Strange, deleted the formulas made new ones with a slightly different name and it works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top