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

Add Reset to formula - Crystal 8.0.1.0 - Win XP - PSI software

Status
Not open for further replies.

mrichelle

MIS
Apr 16, 2007
30
US
Using subreports within main report, need to get a subtotal for shipped quantity. Using formulas below:

1. WhilePrintingRecords;
Shared NumberVar GTotal:=0;
Put this in the main report header

2. WhilePrintingRecords;
Shared NumberVar GTotal:= GTotal + Sum ({ARJOB.SHIPQUANT}, {ARJOB.LJOB});
Put this in the subreport

3. WhilePrintingRecords;
Shared NumberVar GTotal;
GTotal
Put this in the report footer ( for the subtotal, put in the group footer)

It almost works, except something is going on with the subtotal for every customer after the 1st customer.
For instance:
I am looking at two customer's data, the first customer listed has a correct ship quantity subtotal, the next customer listed has a "running subtotal" if that makes sense.

Example:
First customer has shipped quantities of 11,001 and 11,001
which gives subtotal of 22,002 which is correct.
But the second customer has 1403,1586,and 2
which should give a total of 2,991 but it does not instead it gives a total of 24,993
which is the same total as the bottomline "Total" for the whole report

Is there a way to tweak one of the formula's to give a subtotal for each customer that shows up in the report? Do I need to tell one of the formulas to "Reset" and if so...where and how do I do this?



 
You need to group on the Customer in the main report, and then create three new formulas to count the customer total "CTotal"

Reset the "CTotal" to 0 in the Group Header of the main report for the Customer group.

Increment the "CTotal" in the subreport (detail?)

Display the "CTotal" Group Footer of the main report for the Customer group.


 
Wow! I think it works now. What I did was group by customer as you suggested, and then took the formula out of the report header and placed it into the newly created group header for the customer and voila! I cannot believe it was just that simple. I have been pondering over this all day. Thanks so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top