Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Equal to one and ONLY one of list Post Reply Post New Topic
Author Message
NCBeach4Me
Newbie
Newbie
Avatar

Joined: 28 Sep 2009
Location: United States
Online Status: Offline
Posts: 15
Quote NCBeach4Me Replybullet Topic: Equal to one and ONLY one of list
     Posted: 05 Apr 2011 at 4:54am

Table with name, address and district.  District can be multiple values per person. Can look like this:

John Doe  123 Main St   District 1
                                           District 2
                                           District 3
Jane Doe   352 Flower Ave  District 1
Jude Doe   456 Sunset Rd   District 1
                                                 District 4
 
Everybody has District 1.  Some ONLY live in District 1 with no additional districts.
I only want the people who live in District 1 ONLY.  Not the ones who live in District 1 plus other districts.
Problem is, if I do a select where district is "not in a list of" and exclude all the other districts, I still get them because...yeah they live in District 3 which is not District 1.  So it returns those.  How do I get just the people who live in District 1 ONLY?
 
Thanks in advance.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Apr 2011 at 5:14am
group on name
do a group group selection criteria in the select expert as
count(districtfield,namefield)=1
IP IP Logged
NCBeach4Me
Newbie
Newbie
Avatar

Joined: 28 Sep 2009
Location: United States
Online Status: Offline
Posts: 15
Quote NCBeach4Me Replybullet Posted: 05 Apr 2011 at 5:25am

The District field contains text, like "District 1" so the count formula is throwing an error on me.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Apr 2011 at 5:32am
but each district is a different row of data correct?
IP IP Logged
NCBeach4Me
Newbie
Newbie
Avatar

Joined: 28 Sep 2009
Location: United States
Online Status: Offline
Posts: 15
Quote NCBeach4Me Replybullet Posted: 05 Apr 2011 at 6:37am
Yes.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Apr 2011 at 6:41am
so if you insert a summary of the District as a COUNT at the group level of person
you should get this
John Doe  123 Main St   District 1
                                           District 2
                                           District 3
Count=3
Jane Doe   352 Flower Ave  District 1
Count=1
Jude Doe   456 Sunset Rd   District 1
                                                 District 4
count=2
now you can use that data to select at a group level
COUNT(table.district,table.name)=1
IP IP Logged
NCBeach4Me
Newbie
Newbie
Avatar

Joined: 28 Sep 2009
Location: United States
Online Status: Offline
Posts: 15
Quote NCBeach4Me Replybullet Posted: 05 Apr 2011 at 7:48am
Clap  Worked perfectly!  Thank you SO much!
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