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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running total formula problem

Status
Not open for further replies.

ukleaf

Programmer
Mar 16, 2004
27
GB
Hi everyone,

I have a query with a formula; basically I have a running total e.g.

>> shared numbervar aaalcount;

>> if {claim.cm_ref} startswith("AAA/L") then aaalcount := >> aaalcount + 1

Now the problem I seem to be having is the formula seems to be adding up ok in the details section, say for example there were 23. When I call this formula in the report footer to show the final total it always adds one on to the total, does anyone know why this happens and if there is something I can add to the formula to sort this out.

Many thanks.
 
What formula are you using in the report footer? You need a separate formula like this, that doesn't accumulate:

whileprintingrecords;
shared numbervar aaalcount;

-LB
 
This was my original formula in the report footer,

shared numbervar bloggscount;

This returned 2 when it should have returned 1. Even adding the whileprintingrecords,

whileprintingrecords;
shared numbervar bloggscount;

It still seems to be showing 2 as the final amount.
 
Are you sure you haven't mistakenly left a copy of the accumulation formula in the footer along with the display formula?

I think you should show some sample data. Also, please explain why you are using "shared"--is the data in a subreport?

-LB
 
I think what LB meant was that it might be referenced elswhere.

To try to discover any other versions of the formula, change the datatype of the output to a string, if any other formaulas reference it, they will error out and pop up.

The whileprintingrecords should be in both formulas, btw.

The point is that Crystal adds just fine, it's very unlikely that your problem is a bug of such huge proportions.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top