cancel
Showing results for 
Search instead for 
Did you mean: 

Using Boolean parameter

Former Member
0 Kudos

Post Author: gazala

CA Forum: General

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 ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: gazala

CA Forum: General

I got my query worked by simply applying UPPER function around Parameter name and its value and the code looks like as below:

select event_id,event_dt from evt_event where event_dt like decode(upper('{?alldates}'),upper('True'),'%') or event_dt between {?sdate} and {?edate}.

I figured out that crystal take Boolean parameter as a String.

Former Member
0 Kudos

Post Author: SKodidine

CA Forum: General

I would suggest that you re-write your DECODE with IF THEN first. I do not use Oracle/PLSQL so I cannot test it. I think the decode is not working the way you want it to. This is the crystal syntax but you can easily convert it into your native SQL. Get it working for both true and false and then you can convert it to DECODE if necessary.

If {?alldates} = true then event_dt = event_dt

else event_dt in {?startdate} to {?endedate}