Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Duplicate records Post Reply Post New Topic
Author Message
robbo1012
Newbie
Newbie


Joined: 29 Oct 2014
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote robbo1012 Replybullet Topic: Duplicate records
     Posted: 22 Jan 2015 at 9:54pm
Doing a report where I have duplicate records, I have managed to suppress these using the following
{INVOICE.ORDER_NUMBER}=previous({INVOICE.ORDER_NUMBER})
But I am also doing a summary on cost and the "Sum of INVOICE.CARR_NET" appears to still be pulling the costs on duplicate records that have been suppressed.

I know this must be to do with the way the tables are linked on the database because what we have is an order going out with 3 lines linked to the order number with 1 shipping cost, but the shipping cost is pulling in 3 times on the report once for each line on the order, I can suppress the order number to only show once, but the summary (sum) still adds the cost associated with the missing lines.

Hope this makes sense.
I tried a few of the other topics which helped me suppress the duplicate records but cant find an answer that will help me ignore the associated costs.

Any help appreciated
Thanks
Rob

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Jan 2015 at 12:58pm
You might be able to use a Running Total, but that is not my forte, but DBlank.

Mine is shared variables, which is how I would do the sum. They come in groups of 3
initialize (usually placed in a header)
shared numbervar x:=0;
"" //will hide the 0 on the report

display (usually placed in a footer)
shared numbervar x;

increment (usually in the detail section) this tends to be the toughest
shared numbervar x;

if {table.field} <> previous({table.field}) then
x := x + {table.field2};

"" //again hides the running amount.

HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Jan 2015 at 5:00am

as a general rule in crystal do not confuse getting data to display a particlular way (unduplicated) and actually altering your data set. The sppressed data is still part of the report and must be accounted for in any calculations.

lockwelle gave you the shared variable solution, here is a Running Total (RT) solution.
In field explorer find RTs and select New
Name=whatever
Field to summarize = INVOICE.CARR_NET
type of sumamry = SUM
evaluate = on change of field (INVOICE.ORDER_NUMBER)
reset= never
place in report footer
you can alter the reset location if you have groups and need sumas at some other group leve
you can also alter the selection in evaluate to use on change of group if your group structure makes sense for it.
IP IP Logged
robbo1012
Newbie
Newbie


Joined: 29 Oct 2014
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote robbo1012 Replybullet Posted: 01 Feb 2015 at 9:48pm
that works DBlank
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum