Print Page | Close Window

Excluding Users in a report with Static boolean pr

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=7233
Printed Date: 21 May 2024 at 11:19pm


Topic: Excluding Users in a report with Static boolean pr
Posted By: flazaro28
Subject: Excluding Users in a report with Static boolean pr
Date Posted: 03 Aug 2009 at 11:20am
Hello,
I'm developing a report with Userid's and Usernames and their activities.

I need to create a flag status static prompt such that when a user selects "TRUE" then the report should display All the users + excluded user list

When user selects "FALSE", the report should display All the users - excluded user list.

How can we create such prompt ?




Replies:
Posted By: DBlank
Date Posted: 03 Aug 2009 at 11:56am

How are you defining "excluded users"

Basically as answered in your other post you add a parameter Field.
You can add it as a BOOLEAN data type and name it whatever but we will call it "My Parameter" for now.
In the Select Expert write a formula that uses the parameter to filter the records.
I think you want it to include all records from your DB if they pick TRUE and only pick a subset of users if they pick FALSE.
so this will be something like:
{?My Parameter}=TRUE or {table.field}=condition


Posted By: flazaro28
Date Posted: 03 Aug 2009 at 2:17pm
Originally posted by DBlank

How are you defining "excluded users"

Basically as answered in your other post you add a parameter Field.
You can add it as a BOOLEAN data type and name it whatever but we will call it "My Parameter" for now.
In the Select Expert write a formula that uses the parameter to filter the records.
I think you want it to include all records from your DB if they pick TRUE and only pick a subset of users if they pick FALSE.
so this will be something like:
{?My Parameter}=TRUE or {table.field}=condition
 
 
DBlank...Excluded Users are certain users where their userid's are filtered out in selection criteria in general:
 
example : NOT({USERID}  in ('yui002347',yui9089387',.....) )
 
my question is
 
 
when we select "TRUE" from the drop down list of values (LOV), then the report should display all the Users data + Excluded Users data in the report.
 
 
When we Pick "FALSE" from the drop down List of Values (LOV) then the report should display  Userdata - ExcludedUsersdata...so basically here I'm separating out the Excluded users list data when FALSE is selected.
 
 


Posted By: DBlank
Date Posted: 03 Aug 2009 at 3:02pm
OK I think I understand now. I thought you were looking for a paramter to change your actual select statement and you are looking to create a cascading parameter where your first paramter of True/False changes your next parameter which is a list of users, correct?
 
I am at a loss on this although someone else may be able to answer for you. You first need a data source that has a TRUE FALSE option per row that is equivalent to your include or exclude criteria.
However, the problem as I see it is you are looking for a selection of TRUE to include all records and FALSE to limit the selection. Cascading parameters are going to limit it either way and I do not know how you would avoid that.
The only thing I can think of would be to make your firsy parameter allow Multiple values. users would have to select both instead of TRUE to get all users. Otherwise if the select TRUE or FALSE it would limit based on the selection.


Posted By: flazaro28
Date Posted: 04 Aug 2009 at 6:46am
Originally posted by DBlank

OK I think I understand now. I thought you were looking for a paramter to change your actual select statement and you are looking to create a cascading parameter where your first paramter of True/False changes your next parameter which is a list of users, correct?
 
 
Yes I'm looking for a prameter, but Its not really a cascading prompt. Its just one single prompt with (TRUE & FALSE as List of Values (LOV's) ).so when TRUE is selected, it should  include all the userid's & its activites.
 
 
when False is selected, it should include only  users - excludeduserslist


Posted By: DBlank
Date Posted: 04 Aug 2009 at 7:01am

OK- if you are not using two paramters then I go back to my original answer but you will have to change it to meet your conditions.

Create a Parameter as a Boolean Type (this will automatically make it have TRUE FALSE select values.
You can name it whatever you want but for this example I am naming it "My Parameter".
Now in your select statement you use an OR statment to flip your selection criteria based on the choice of the TRUE or FALSE.
 
{?My Parameter} or
(all of your conditions for Ecluded users here like... NOT({USERID}  in ('yui002347',yui9089387',.....) )
 
The blue ink handles teh TRUE seelction by NOT filtering any records from your DB. The OR which would be a selection of FALSE would filter your records by whatver condtions you put in those parenthesis.


Posted By: flazaro28
Date Posted: 04 Aug 2009 at 7:52am
Originally posted by DBlank

OK- if you are not using two paramters then I go back to my original answer but you will have to change it to meet your conditions.

Create a Parameter as a Boolean Type (this will automatically make it have TRUE FALSE select values.
You can name it whatever you want but for this example I am naming it "My Parameter".
Now in your select statement you use an OR statment to flip your selection criteria based on the choice of the TRUE or FALSE.
 
{?My Parameter} or
(all of your conditions for Ecluded users here like... NOT({USERID}  in ('yui002347',yui9089387',.....) )
 
The blue ink handles teh TRUE seelction by NOT filtering any records from your DB. The OR which would be a selection of FALSE would filter your records by whatver condtions you put in those parenthesis.
 
 
 
so should I write my formula in selection criteria as:
 
If {?My parameter} or NOT({USERID}  in ('yui002347',yui9089387',.....) )
 
then 'FALSE'
 
else  'TRUE'
 
 
 
 


Posted By: DBlank
Date Posted: 04 Aug 2009 at 8:03am
Nope. You do not need an If then statement just an OR.
With the OR stement it will stop as soon as it finds a condition that is TRUE.
Since you are using a Boolean type and you want all records if the paramter is True the first part of your seelct statement is
 
{?My parameter} or
 
If TRUE was selected in the parameter value then this condition = TRUE and the select formula stops there without doing any filtering (if you have other conditions like date ranges then you need to alter to account for those with an AND statement). This isa lso more efficient because it does not need to read the DB at all.
From there the only oher option for the parameter to be is FALSE.  Therefore if it is npot TRUE then your OR is what you want the select statement to be as if they picked FALSE.
Create one statement with parenthesis around the entire logic if there is more to it than the user id not being  in a list.
( NOT({USERID}  in ('yui002347',yui9089387',.....) and any other criteria here )
If it is only that they are not in the UserID list you do not have to use the extra parnethesis
Make sense?


Posted By: flazaro28
Date Posted: 04 Aug 2009 at 10:55am
Originally posted by DBlank

Nope. You do not need an If then statement just an OR.
With the OR stement it will stop as soon as it finds a condition that is TRUE.
Since you are using a Boolean type and you want all records if the paramter is True the first part of your seelct statement is
 
{?My parameter} or
 
If TRUE was selected in the parameter value then this condition = TRUE and the select formula stops there without doing any filtering (if you have other conditions like date ranges then you need to alter to account for those with an AND statement). This isa lso more efficient because it does not need to read the DB at all.
From there the only oher option for the parameter to be is FALSE.  Therefore if it is npot TRUE then your OR is what you want the select statement to be as if they picked FALSE.
Create one statement with parenthesis around the entire logic if there is more to it than the user id not being  in a list.
( NOT({USERID}  in ('yui002347',yui9089387',.....) and any other criteria here )
If it is only that they are not in the UserID list you do not have to use the extra parnethesis
Make sense?
 
 
 
Thanks Dblank...Its working..Appreciate your help



Print Page | Close Window