Lan Cui
Lan Cui

Reputation: 137

How to avoid including duplicate records in group summaries in Crystal Reports

I have a report which groups the record by company, customer, Invoice, date... but i have duplicated records. I want to sum the total and not include the duplicate records. I use the running total, and ongroup change to invoice. It works for the grand total in the report footer but i still want to get a subtotal in this case will be 15006.26 + 39772.26 + 21140.00 + 4571.92.

I tried to use the whileprintingrecords and declare a currencyvar=0 and recalculate the total like this

Whileprintingrecords;
currencyvar Amt;
if previous ({brptARAgeUPSSequence;1.Invoice})<>{brptARAgeUPSSequence;1.Invoice} then    
    currencyvar Amt:= Amt + {brptARAgeUPSSequence;1.AgeAmount}
else if onfirstRecord then 
    currencyvar Amt:= {brptARAgeUPSSequence;1.AgeAmount}

But I get all the O , i do not know what is the problementer image description here

Upvotes: 0

Views: 3232

Answers (2)

Ryan
Ryan

Reputation: 7287

You need two Running Totals: one for the grand total and one for the group level. Since it sounds like you've got the one for grand totals working, all you need to do is duplicate that one and make one small change to it to get it to work at the group level.

In the new Running Total settings, just change the "Reset" field from "None" to "On change of group" and select the group level you want this to work at. Then, place this new RT in the appropriate Group Footer section of your report.

Upvotes: 2

Nick
Nick

Reputation: 3347

Seems like Amt is being re-declared. Try this

Whileprintingrecords;
currencyvar Amt;
if previous ({brptARAgeUPSSequence;1.Invoice})<>{brptARAgeUPSSequence;1.Invoice} then    
    Amt:= Amt + {brptARAgeUPSSequence;1.AgeAmount}
else if onfirstRecord then 
    Amt:= {brptARAgeUPSSequence;1.AgeAmount}

Upvotes: 1

Related Questions