Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Using Static Boolean parameters in Crystal reports Post Reply Post New Topic
Author Message
flazaro28
Newbie
Newbie


Joined: 30 Apr 2009
Location: Poland
Online Status: Offline
Posts: 35
Quote flazaro28 Replybullet Topic: Using Static Boolean parameters in Crystal reports
     Posted: 31 Jul 2009 at 1:23pm
I'm displaying all the usernames and userid's in my report.

I'm trying to exclude few userid's in my report based on TRUE/FALSE or YES/NO boolean values.

How can we do that?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2009 at 1:32pm
In the select expert add the formula to evaluate each row for that criteria.
 
the filter process will include rows only where your statement=TRUE for that row so it will be something like
 
{table.field}=True


Edited by DBlank - 31 Jul 2009 at 1:32pm
IP IP Logged
flazaro28
Newbie
Newbie


Joined: 30 Apr 2009
Location: Poland
Online Status: Offline
Posts: 35
Quote flazaro28 Replybullet Posted: 31 Jul 2009 at 1:50pm
Originally posted by DBlank

In the select expert add the formula to evaluate each row for that criteria.
 
the filter process will include rows only where your statement=TRUE for that row so it will be something like
 
{table.field}=True
 
 
Thanks Dblank...But I need to display a prompt such that if 'TRUE' is selected it will include all the users including excluded list
 
If No is selected, it will exclude the users and display only the required users..
 
How can we do this?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2009 at 1:51pm
You want a run time parameter to let a user choose what to see when they run the report?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2009 at 1:58pm

Here is a sample process although you can alter the param type or options in a lot of ways...

Right click on Parameter Fields in the Field Explorer and select NEW.
Name it, our example will use "Is Active"
Type = String
List of values Add Yes and No
Save it
 
Now in your select statement use the parameter field.
if {?Is Active}="Yes" then table.field=True else table.Field=False


Edited by DBlank - 31 Jul 2009 at 1:59pm
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 31 Jul 2009 at 2:40pm

[soapbox]If the fields are boolean type, you don't need to include "=True" or "=False".  The field value itself provides the true or false value.  Also, using If statements in the select criteria can slow down processing because Crystal has to process the records instead of the database.

So, this could also read:

({?IsActive} = 'Yes' or (<criteria to exclude records>))

Notice the use of parentheses - if there is more than one criteria used to exclude fields, you should put parens around all of that part of the statement.  When using an "or" statement along with other selection criteria, you MUST put parens around both 'sides" of the or statement, otherwise you won't get the data you're looking for.

-Dell

 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Jul 2009 at 2:44pm
I knew it when I typed it and actually thought this might make you chagrin  Wink
 
...just couldn't decide on a way to have it make sense when typing it up.
Thanks for keeping me on my toes and making a better post answer!


Edited by DBlank - 31 Jul 2009 at 2:46pm
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