If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Conditional prompt in Report Studio

Started by sandy_vitty, 07 Jun 2012 04:06:01 PM

Previous topic - Next topic

sandy_vitty

Hi Gurus,

               Tried searching for solution in the forum but could not find any so posting the question. I have two prompt Time prompt and Time selection. Under Time prompt i have last 7 days, WTD, last 31 days and MTD. THe second prompt has Monday, Tuesday,..... Sunday ( all seven days in a week). It also has 1 through 31 for the days in month as values in same Time Prompt. With help of javascript i show the week days when Last 7 days are selected and 1 through 31 days when Last 31 days are selected. But i when i try to use a conditional filter in the detail filter i get lost of errors. i am trying to do something like this.

if
?p_Timeprompt?='Last 7 days' and ?p_timeselection? is null  then [DATE]=_first_of_month(current_date) 
else if
?p_Timeprompt?='Last 7 days' and ?p_timeselection? is not null then ([DATE_NAME]= ?p_timeselection? and [MONTH]=MONTH(CURRENT_DATE)
ELSE IF
?p_Timeprompt?='Last 31 days' and ?p_timeselection? is NULL then ([DATE_NAME]= ?p_timeselection? and [MONTH]=_first_of_month(current_date) 

I am able to apply the filters for MTD and WTD correctly to the report and the report get filtered currectly but when i try to put above 2 conditions i get error.
Please help.
Thanks

wyconian

Hi

You can't have an if statement in a filter.  The filter has to be boolean expressinns which can evauate to true or false

Try something like
(?p_TimePrompt? = 'Last 7 days' and ?p_timeselection is null and [DATE] = _first_of_month(current_date) )
or (?p_TimePrompt? = 'Last 7 days' and ?p_timeselection is not null and ([DATE_NAME]= ?p_timeselection? and [MONTH]=MONTH(CURRENT_DATE) )
or (?p_Timeprompt?='Last 31 days' and ?p_timeselection? is NULL and ([DATE_NAME]= ?p_timeselection? and [MONTH]=_first_of_month(current_date)  )

You basically end up with 3 boolean expressions where only one of them can be true.

Good luck :-)