Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Suppress group if duplicate names in detail Post Reply Post New Topic
Page  of 2 Next >>
Author Message
wanttoknowmore
Newbie
Newbie


Joined: 26 Mar 2015
Online Status: Offline
Posts: 7
Quote wanttoknowmore Replybullet Topic: Suppress group if duplicate names in detail
    Posted: 18 Nov 2016 at 8:05am
I have a fairly simple report, that I need to complicate. [IMG]smileys/smiley5.gif" align="middle" />   It's for our payroll department, and she wants to show duplicate ACH accounts, for employees. She's checking for data entry errors.

Report uses 2 tables, employee and bank account, and I'm printing rows for any bank account that has at least 2 employees with that same account. (This is normally a couple that is using the same bank account - we are a school division so lots of married employees.) So usually there will be a group header (bank acct# and the count of duplicates), and 2 detail rows (emp#, name, bank account). There are a few groups that have 3 rows (I guess 2 parents and a child).

I have this in the group selection formula: Count ({EMACHDEPST.EBNK_ACCT_NBR}, {EMACHDEPST.EBNK_ACCT_NBR}) > 1

And honestly - I don't even know why/ that^^ works, but it does. (If anyone wants to explain that to me, please feel free! Yes I wrote the report but I can't remember how I came up with that!)

I then have this in the "suppress drill down" formula, in the Group Header:
If Count({EMACHDEPST.EBNK_ACCT_NBR}) < 2 then TRUE

So if there are 2 or more employees with the same bank account, they are printed.

THAT works.

Now the complication. User wants to suppress the group if the last name is the same. So say I have this...

12345 Jones   Adam   1122334455
54321 Jones   Mary   1122334455

   Bank acct 1122334455    2

32156 Smith   John   998877
5462   White   Sara   998877

   Bank acct 998877        2

So I would want to suppress the first group - the Jones - due to the duplicate name.   

Racking my brain here but I'm stumped. How do I suppress the group for a duplicate name? And if there are 3 records, and one is different...I might need to
also look at the home address and suppress on that as well.
Appreciate your help!!


Edited by wanttoknowmore - 21 Nov 2016 at 3:42am
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 18 Nov 2016 at 9:40am
The group selection formula is pretty easy.  Only show records where the count of {EMACHDEPST.EBNK_ACCT_NBR} grouped by {EMACHDEPST.EBNK_ACCT_NBR} is greater than one.  Unfortunately I cannot think clear enough for your second question (I think you need a sub-report).
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 21 Nov 2016 at 3:07am
look at your grouping and start using comparatives of counts vs. distinct counts at that group level until you get all criteria you want.
I am not entirely following all the criteria so here is an example of one possible criteria...

Count(lastname,EMACHDEPST.EBNK_ACCT_NBR) <> DISTINCTCOUNT(lastname,EMACHDEPST.EBNK_ACCT_NBR)

Edited by DBlank - 21 Nov 2016 at 3:08am
IP IP Logged
wanttoknowmore
Newbie
Newbie


Joined: 26 Mar 2015
Online Status: Offline
Posts: 7
Quote wanttoknowmore Replybullet Posted: 21 Nov 2016 at 4:02am
I'm sorry - not following.

My groups are based on account numbers. If 2 or more people have the same account number, then that group is printed. However, if 2 of the people in the group, have the same last name, then I want to suppress that group.

I feel like I need to add something to check the last names for duplicates, but I don't know where or how.

Edited by wanttoknowmore - 21 Nov 2016 at 9:41am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Nov 2016 at 2:40am
so if the count of the last name in that group = distinct count of last names in that group all of the people in that group have a unique last name. if not, at least two people share a name. Use that logic for the show/suppress

Edited by DBlank - 22 Nov 2016 at 2:40am
IP IP Logged
wanttoknowmore
Newbie
Newbie


Joined: 26 Mar 2015
Online Status: Offline
Posts: 7
Quote wanttoknowmore Replybullet Posted: 22 Nov 2016 at 8:27am
I understand what you are saying, just that I don't know where to do that. Sorry I am not a Crystal expert at ALL.

Where I have this:
Count ({EMACHDEPST.EBNK_ACCT_NBR}, {EMACHDEPST.EBNK_ACCT_NBR}) > 1

Do I put a second count in there?

Edited by wanttoknowmore - 22 Nov 2016 at 8:28am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Nov 2016 at 10:34am
You can completely exclude groups using the group select or you can suppress sections using it.
I don't know what your preference is nor where you are currently using the condition of
Count ({EMACHDEPST.EBNK_ACCT_NBR}, {EMACHDEPST.EBNK_ACCT_NBR}) > 1

You would keep your existing condition and append the rest to it with an "AND ..."
IP IP Logged
wanttoknowmore
Newbie
Newbie


Joined: 26 Mar 2015
Online Status: Offline
Posts: 7
Quote wanttoknowmore Replybullet Posted: 22 Nov 2016 at 10:56am
[URL=http://s297.photobucket.com/user/chesapeakemom/media/crystal3_zpswbwn9we0.jpg.html][IMG]http://i297.photobucket.com/albums/mm235/chesapeakemom/crystal3_zpswbwn9we0.jpg" />



Edited by wanttoknowmore - 23 Nov 2016 at 5:54am
IP IP Logged
wanttoknowmore
Newbie
Newbie


Joined: 26 Mar 2015
Online Status: Offline
Posts: 7
Quote wanttoknowmore Replybullet Posted: 23 Nov 2016 at 5:50am
Still hoping for some guidance here. I have removed the stuff that I had added to get back to a working report. I'm hoping that if I present a clearer picture of what I have, someone can help. (FWIW, our Crystal report "guru" here is also stumped by this!!















[IMG">http://i297.photobucket.com/albums/mm235/chesapeakemom/Crystal/crystalGFsuppress_zpsmi21qo84.jpg" />


So those are all the "pieces" I have in the report, right now. And for just printing the employees that have the same accounts, it works. I've not been able to figure out how to suppress the groups where the last names match. I only want to print a group, if the last names are different.










Edited by wanttoknowmore - 23 Nov 2016 at 6:16am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Nov 2016 at 6:54am
You can add it all into the group selection process (formula) if you want.
I think all 3 conditions are met by using:
DISTINCTCOUNT({EMPLOYEE.Last_Name}, {EMACHDEPST.EBNK_ACCT_NBR}) > 1
IP IP Logged
Page  of 2 Next >>
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.031 seconds.