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 date filter

Started by cognos4all, 10 Apr 2010 10:28:23 AM

Previous topic - Next topic

cognos4all

i have a report where i want to do the conditional filter but i am getting error when i try.
I have a report with optional date prompt, When i run the report first time i want to run the report for last 15 days (this is the dafault), but when the user select the date range from the date prompt after running the report then i want to apply selected date as filter instead of default date filter. I am using date prompt control in the report.

i tried this and didn't worked. What am i doing wrong.

If (  ?InputDateRange? is not missing  ) then
[Date] in_range ?InputDateRange?
else
[Date] >=  _add_days (current_date , -15)

MFGF

Quote from: cognos4all on 10 Apr 2010 10:28:23 AM
i have a report where i want to do the conditional filter but i am getting error when i try.

Unless you give us an idea of the error message you are seeing, we can't really suggest what may be wrong.

MF.
Meep!

cognos4all

#2
Quote from: MFGF on 13 Apr 2010 04:53:41 AM
Unless you give us an idea of the error message you are seeing, we can't really suggest what may be wrong.

MF.

MF, Thanks for the reply
I am getting below error when i try to validate the expression

QE-DEF-0459 CCLException
QE-DEF-0260 Parsing error before or near position : 63 of : "if ( ?InputDateRange? is not missing )
THEN [Date]"
QE-DEF-0261 QFWP - Parsing text: if ( ?InputDateRange? is not missing )
THEN [Date] in_range ?InputDateRange?
ELSE
[Date] >=  _add_days (current_date , -15)

For some reason it doesn't like the parameter in the if condition.

I would appreciate any suggestion.


MFGF

Hi,

Have you tried adding parentheses around the conditional filter expressions, ie:

if ( ?InputDateRange? is not missing )
THEN ([Date] in_range ?InputDateRange?)
ELSE
([Date] >=  _add_days (current_date , -15))
Meep!

cognos4all

Quote from: MFGF on 14 Apr 2010 06:25:55 AM
Hi,

Have you tried adding parentheses around the conditional filter expressions, ie:

if ( ?InputDateRange? is not missing )
THEN ([Date] in_range ?InputDateRange?)
ELSE
([Date] >=  _add_days (current_date , -15))


Thanks MF for the reply.
When i put the quotes the expression did validate, but when i run the report after making the date range selection i get error.
" RQP-DEF-0177  An error occurred while performing operation 'sqlPrepareWithOptions' status='-16'.  "

Also when i run the report first there is no date selection as it is optional filter, i assume InputDateRange is null, but it doesn't seem that way. It is not getting the default value (else condition). It takes the condition  ([Date] in_range ?InputDateRange?)

Now if i select the date from the date prompt then i get the above error. However if i check the earliest date and latest date radio button of the date prompt then i don't get error.

Not sure what the default value is in the date prompt. I haven't set any default value for the date prompt. I tried checking the length, value of the default
date prompt value, but it doesn't show anything.