Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Duplicate detail lines Post Reply Post New Topic
Author Message
bhar4
Newbie
Newbie


Joined: 18 Jul 2012
Online Status: Offline
Posts: 11
Quote bhar4 Replybullet Topic: Duplicate detail lines
     Posted: 09 Aug 2012 at 5:01am
I am summing current pay period hours from the PRDISTRB table and occasionally getting duplicate detail lines printed and summed.  This appears to be happening on employees who have been moved from one position code to another.  I looked in the PRDISTRB file and there are not any duplicate records. 
 
This is my formula code:
 
if {PRDISTRIB.PER_END_DATE}={Command.PER_END_DATE2} then
{PRDISTRIB.R_HOURS}
 
 
then this is summed
 
any ideas on what might be causing this and how to fix
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Aug 2012 at 5:45am
these are almost always the result of the product of joining your tables.
If you cannot get your tables or source to return distinct rows the solution is usually to suppress the duplicate rows and use shared variable formulas or Running Totals to do your calculations. Suppressed data is still included in summary functions, hence the use of the formulas or RTs.


Edited by DBlank - 09 Aug 2012 at 5:46am
IP IP Logged
bhar4
Newbie
Newbie


Joined: 18 Jul 2012
Online Status: Offline
Posts: 11
Quote bhar4 Replybullet Posted: 09 Aug 2012 at 9:08am
Since I am new to Crystal I don't know how to suppress the duplicate rows. 
I did add a running total and got a different result but it wasn't correct.
 
Report is showing 160 hours when I use sum and it should be 80 hours.
When I tried running total it showed 72 hours, which I really don't see how it got that.  I added funnel to only process one of the employees I am having the problem with, so I would assume I would only be totaling hours for that one person.  Which should add up to 80 hours.
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Aug 2012 at 9:25am
you suppress sections (a row is usually a detail section) by going into the section expert and selecting the formula (x-2) button next to the 'Suppress (no Drill down)' option.
you add a boolean evaluation formula, true results in suppressed and false results in show.
i assume you have a primary key per 'pay row' and if you placed that field on your report canvas it would duplicate on your 'doubled rows'.
if that is correct you will use something like
not onfirstrecord and previous(table.id)=table.id.
 
Running Totals have to be placed in detail sections or footers. If you place them in headers they will not calculate any rows below the first row in the grouping that you placed it on.
perhaps that explains your total?
if not I would need to see some sample row level data and how you want it calculated to help much more.
 
 


Edited by DBlank - 09 Aug 2012 at 9:27am
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