Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Boolean Allow Multiple Values Post Reply Post New Topic
Author Message
SDNewsome
Newbie
Newbie


Joined: 21 Apr 2009
Location: United States
Online Status: Offline
Posts: 4
Quote SDNewsome Replybullet Topic: Boolean Allow Multiple Values
    Posted: 19 May 2009 at 11:21am
How do I create a parameter based on a boolean field that will allow the user to select multiple values?  I'm using Crystal Reports XI.

Edited by SDNewsome - 19 May 2009 at 11:22am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 May 2009 at 11:37am
Do you mean you want them to be able to Select between 3 options: "True", "False" or both "True and False"?
IP IP Logged
SDNewsome
Newbie
Newbie


Joined: 21 Apr 2009
Location: United States
Online Status: Offline
Posts: 4
Quote SDNewsome Replybullet Posted: 19 May 2009 at 11:39am
Exactly.  I want the user to be able to select "True", "False", or both "True" and "False".
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 May 2009 at 11:52am

Create a parameter as Text with those 3 options. In your select statement handle the 3 items to get the appropriate records.

If {?parameter}="True" then {table.boolean field}=true else
If {?parameter}="False" then {table.boolean field}=False
IP IP Logged
SDNewsome
Newbie
Newbie


Joined: 21 Apr 2009
Location: United States
Online Status: Offline
Posts: 4
Quote SDNewsome Replybullet Posted: 19 May 2009 at 12:53pm

I created a static, string parameter {?Active} with no Value Field and the Values of "true" and "false".  I allowed multiple values.  The Select Expert formula is:

{EMPMAST.CLASS} = {?Class} and (sworn, non-sworn, civilian, etc.)
If {?Active}="True" then {EMPMAST.HIDE}=true else
If {?Active}="False" then {EMPMAST.HIDE}=False and
{empmast.hired}={?daterange} and
{EMPMAST.UNIT} startswith "DEP" and (this is no longer working)
{EMPMAST.UNIT} = {?District}
 
The parameter screen looks great, but the data that appears in the report is incorrect. 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 May 2009 at 12:57pm
{EMPMAST.CLASS} = {?Class} and 
{empmast.hired}={?daterange} and
{EMPMAST.UNIT} startswith "DEP" and
{EMPMAST.UNIT} = {?District} and
(If {?Active}="True" then {EMPMAST.HIDE}=true else
If {?Active}="False" then {EMPMAST.HIDE}=False else
{EMPMAST.HIDE}={EMPMAST.HIDE})


Edited by DBlank - 19 May 2009 at 12:57pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 May 2009 at 2:21pm
Sorry, I should have explained the change but was running into a meeting when i answered earlier and wanted you to be able to fix it...
You ned to make the "if-then-if" a single evaulation in the overall selection process. In your statement, once it found an "if-then" that it could use (which would be all records because all records would be one of the 3 options) it stopped evaluating the rest of your selection criteria.
By adding () around the full if-then-if statement it will evaulate it as a single part of the criteria. I also added the somewhat bogus final else of "{EMPMAST.HIDE}={EMPMAST.HIDE}" so it won't choke on the "and" prior to the if then statement if it didn't find true or false. It may not be needed but I think it is...
IP IP Logged
SDNewsome
Newbie
Newbie


Joined: 21 Apr 2009
Location: United States
Online Status: Offline
Posts: 4
Quote SDNewsome Replybullet Posted: 20 May 2009 at 10:17am
That fixed it.  Thank you very much!!!
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.031 seconds.