Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: including/excluding parameter values Post Reply Post New Topic
Page  of 2 Next >>
Author Message
ediecrystaluser
Newbie
Newbie


Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 8
Quote ediecrystaluser Replybullet Topic: including/excluding parameter values
    Posted: 27 Apr 2011 at 3:23pm
I have a view that contains the unique identifier of the member and the groups (affiliations) they belong to. If they belong to more than one group they are in the view multiple times. I have a parameter set in my crystal report asking what groups I would like to see. I also have an exclude parameter and was hoping to exclude data where the same record has both the include and exclude groups.

For example, I want to pull everyone that has group A, B & C. But I also want to exclude anyone that also has group D.

My select expert crystal formula looks like this:

{ProfileAffiliation_View.AffPro_AffCode} = {?forAffilations}) and
{ProfileAffiliation_View.AffPro_AffCode} <> {?excludeAffiliations}

However, it doesn't work. Are you able to include and exclude data using the same field in a report?
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Apr 2011 at 3:03am
I'm thinking it might not work because technically, if {ProfileAffiliation_View.AffPro_AffCode} equals 'A B C D' then it does not equal {?excludeAffiliations} if {?excludeAffiliations} equals 'D' ('A B C D' <>'D')

What about keeping the first part and having something like:

{ProfileAffiliation_View.AffPro_AffCode} = {?forAffilations})
and
not({?excludeAffiliations} in {ProfileAffiliation_View.AffPro_AffCode})


|< /\ '][' ( )
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Apr 2011 at 4:05am
Pretty sure you will have to do group selection criteria here. Might be very tricky if you have one inclusion param wich allows for multiple selectiuons and one exclsion criteria with multiple seelctions
IP IP Logged
ediecrystaluser
Newbie
Newbie


Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 8
Quote ediecrystaluser Replybullet Posted: 28 Apr 2011 at 4:11am
Yes, both parameters (inclusion & exclusion) both allow multiple values. I've never done a group selection criteria before. Can you help?
IP IP Logged
ediecrystaluser
Newbie
Newbie


Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 8
Quote ediecrystaluser Replybullet Posted: 28 Apr 2011 at 4:18am
I'm worried I need to re-write the whole report using a command...where basically the SQL goes as follows:

Select ID from Affiliations where ID in (select Id from affiliations where group=includeparameter) and ID not in (select Id from affiliations where group=excludeparameter)

The only issue here is are you able to include multiple values in that parameter and SQL understand it? I'm new to Crystal 2008 and in Crystal 9 you couldn't have multiple values in a parameter that was used in a SQL command.

Thanks so much for your input. I greatly appreciate it.
IP IP Logged
ediecrystaluser
Newbie
Newbie


Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 8
Quote ediecrystaluser Replybullet Posted: 28 Apr 2011 at 4:19am
Hmmm, I'll have to try the and not... I don't think I tried that combination. Thank you!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Apr 2011 at 4:20am
the and not will not work because that is evaluating each row not the group.
 

the idea is that once you groupon a field, in your case you would use member ID #, you can select groups of these based on anything criteria that can be determined via an insert summary function re: that group. In the select expert there is a toggle option to switch between group selection or individual selection. The group selection is also boolean like

Minimum({table.date},{table.customerid}) < {?begindate}
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Apr 2011 at 4:26am

how many "codes" do you have and are they static?

IP IP Logged
ediecrystaluser
Newbie
Newbie


Joined: 27 Apr 2011
Location: United States
Online Status: Offline
Posts: 8
Quote ediecrystaluser Replybullet Posted: 28 Apr 2011 at 4:29am
I have the parameters pulling all possible values dynamically. For now, the number of includes is up to 12 different codes and exclude codes is only 1 at the moment. I did want to allow multiple values on the exclude in case that is an issue moving forward...but if it isn't possible then we'll just have to deal with that.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Apr 2011 at 4:33am
maybe some one else sees a solution allowing for multiple selection in a single param but I think it would require a loop which cannot be used for group selection.
If you had individual params per code with selection options of 'include/ignore' and 'exclude/ignore' you can write formulas to handle it.


Edited by DBlank - 28 Apr 2011 at 4:34am
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.