Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Using Boolean parameter Post Reply Post New Topic
Author Message
gazala
Newbie
Newbie


Joined: 16 May 2007
Location: United States
Online Status: Offline
Posts: 13
Quote gazala Replybullet Topic: Using Boolean parameter
    Posted: 28 Jun 2007 at 9:58am

I have three parameters on report , one is boolean and two are dates.Condition is if user selects True from boolean parameter,it should display all data from table regardless of date ranges,whereas if user select False it should display data within date range.Problem is  its not giving any result if user selects true.when i change the parameter type from boolean to String its giviing result.I have a limitation that i cannot change the parameter type from boolean to String.Below is the query for doing that:

select event_id,event_dt  from event
where event_dt  like  decode('{?alldates}','True','%')  or event_dt between
 {?startdate} and {?endedate}

any suggestions ? 

IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 28 Jun 2007 at 10:28am
I havent researched it but what happens if you remove the string quotes ('True') from around True (True). It may see it as a value and not a string.
 
 
Regards,
 
John W.
 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Jun 2007 at 11:03am
Yeah, I agree that you should remove the quotes from 'True'. However, I'm a bit confused. I know that Boolean in SQL is a 0 or 1, Not the word true or false like it is in CR Syntax. Thus, I would swap out 'True' with 1 (or is it -1 in SQL? I forget). Secondly, the 'like' operator only works with strings. Thus, that is why it makes sense that you have to convert True to a string. But I wouldn't use a string anyway. I would do something like
where {?alldates} =1  or event_dt between  {?startdate} and {?endedate}
To fully research this, I would have to see how CR passes a boolean parameter to SQL. What exact value does SQL see on it's end? Actually, this is a great topic for the book. Please report back if you have a breakthrough. I'll have to put it on my to-do list as well.

Edited by BrianBischof - 28 Jun 2007 at 11:04am
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
gazala
Newbie
Newbie


Joined: 16 May 2007
Location: United States
Online Status: Offline
Posts: 13
Quote gazala Replybullet Posted: 28 Jun 2007 at 11:26am
Thanks for the reply.I got it worked by simply using Upper function around Paramater  name and its value.So it means we have to use ' ' around Boolean parameter.The code looks like as below:
 
select event_id,event_dt  from event
where event_dt  like  decode(upper('{?alldates}'),upper('True'),'%')  or event_dt between
 {?sdate} and {?edate}
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 28 Jun 2007 at 11:37am
Thanks for passing  the solution on to me. Never can tell when I will need to put it to use.
 
 
Regards,
 
John W.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Jun 2007 at 12:11pm
Wow. I still don't understand how that made it work. Gotta print this one out and research it.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.016 seconds.