COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: wyconian on 22 May 2008 06:05:18 AM

Title: multiple parameters in filters
Post by: wyconian on 22 May 2008 06:05:18 AM
Hi

I'm after  a bit of advice.  I need the uses to be able to either select a single date and operator or a date range.

I've set up a prompt for the single date and for the operator (=, <,>,<=,>=) and wanted to add both parameters into the filter but kept getting errors.

The filter looked something like this;

date ?date operator? ?date parameter?

I ended up having to break the date operator out and ended up with a much bigger filter.

Any ideas on why I was getting errors with the first filter and how I should have written it?

As always thanks for the help.
Title: Re: multiple parameters in filters
Post by: rockytopmark on 22 May 2008 06:34:09 AM
Date In_range ?parm?

or

Date between ?fromParm? and ?toParm?
Title: Re: multiple parameters in filters
Post by: wyconian on 22 May 2008 06:39:20 AM
Thanks but I think it was passing the 2 parameters (date and operator) to the filter that was causing the issue.
Title: Re: multiple parameters in filters
Post by: rockytopmark on 22 May 2008 06:43:07 AM
Not really sure what you mean, or how you can pass 2 unrelated parameters to one query subject???  Also, You simply Can't filter a date column on a non-date parameter.

Set up separate filters for each query item that you are filtering on.
Title: Re: multiple parameters in filters
Post by: wyconian on 22 May 2008 07:10:19 AM
I think you're probably right.

What I was trying to do was to get the users to select the operator they wanted as well as the date so that

?date_operator? would be one of =, <, >, <=, >=
and ?date? would be a date

then I was trying to say something like

sales_date ?date_operator? ?date?

so it would read sales_date = 2008-03-14 etc

with the = being the value from the ?date_operator?
Title: Re: multiple parameters in filters
Post by: blom0344 on 22 May 2008 08:51:31 AM

=


<>  value

I doubt you can store 'non-values' in a parameter, though it would be mighty nice  :)
Title: Re: multiple parameters in filters
Post by: almeids on 22 May 2008 09:41:50 AM
I played with a similar approach once, you'll need to format your filter something like:

(?date_operator? = '>' and [dbdate]>?date?)
or
(?date_operator? = '=' and [dbdate]=?date?)
or
etc.
Title: Re: multiple parameters in filters
Post by: wyconian on 22 May 2008 09:47:23 AM
Yeah that's what I ended up doing, thought there might be a 'nicer' way of doing.

Thanks for all your help again  ;D