Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: formula to include duplicates only Post Reply Post New Topic
Author Message
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Topic: formula to include duplicates only
    Posted: 27 Jan 2016 at 11:03am
I have a report that I only want to include the duplicate records for each matching MRN (reports is grouping on MRN).
Report currently looks like this
 
MRN         Patient Name  Acct No  Adm Date
1159XX     Uncle Sam      111        01/01/2016
1159XX     Uncle Sam      222        01/02/2016
1159XX     Uncle Sam      333        01/01/2016
1169XX     Donald Duck   444        01/02/2016
1169XX     Donald Duck   555        01/04/2016
1179XX     Daisy Duck     666        01/03/2016
1179XX     Daisy Duck     777        01/03/2016
 
I want it to look like this
MRN       Patient Name     AcctNo   Adm Date
1159XX  Uncle Sam         111        01/01/2016
1159XX  Uncle Sam         333        01/01/2016
1179XX  Daisy Duck        666        01/03/2016
1179XX  Daisy Duck        777        01/03/2016
 
 
Paula J
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Jan 2016 at 3:14am
display your fields in the group header and suppress the details.
the group header will display the content from the first row in the group so you need the details to be sorting in the order that gets the first row the data you want to display.
Also note that this is only about how the data is being displayed. All of the 'duplicate' data is still part of the report so any calculations or summation you do include all of the rows.

Edited by DBlank - 28 Jan 2016 at 3:15am
IP IP Logged
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Posted: 28 Jan 2016 at 3:26am
This is not working.  I do NOT want just one line.  I want duplicate lines if the adm date is the same and I don't want line when there is not a duplicate.
 
I think my example explains what I want.
Paula J
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Jan 2016 at 3:56am
I misunderstood.
Create group level 2 using a string formula.
I can't tell if some of your fields are strings or numeric so you may need to adjust to deal with that.
//group level formula
totext(table.mrn,0,"")+table.patientname+totext(table.admitdate,"MM/dd/yyyy")
insert a count of the MRN at this group level.
Now whenever that count is>1 you can display else hide
IP IP Logged
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Posted: 28 Jan 2016 at 4:11am
Sorry, I should have said I already have a count on the mrn and set to >1. 
So what you see is a result of that. 
What I need is a way to now say...if mrn match and the admit date on those matching mrn match then print the two records.
Paula J
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Jan 2016 at 4:17am
I understood that.
reread my response. It is accounting for the admit date duplication.
Although I think you can likely remove your top level grouping completely and replace it with the formula grouping i suggested. Sorting might be an issue though.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Jan 2016 at 4:19am
also if your MRN is unique per name you can likely exclude the name form the formula I gave you.
Or you can just a second group on the admit date set to the day and do another count exclusion/suppress on that.
IP IP Logged
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Posted: 28 Jan 2016 at 4:42am
Got it thanks so much.
Paula J
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.020 seconds.