COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: everlearner on 06 Mar 2013 07:24:05 AM

Title: is it possible to select the operation(<,>,=,<=,>=) dynamically & put in query
Post by: everlearner on 06 Mar 2013 07:24:05 AM
Hi Gurus,

I have a date filter to select the date( parameter is pdate). so earlier in my query it is ( date >= ?pdate?)
Now i have to provide an option to select the operation at run time like <,>,=..etc.....
for that i took a value prompt(parameter is pch) next to date prompt with static choices(<,>,=..).
Now how to put this selected value in the query?
dont know is it possible or not... i just tried in this way. suggest me if any other way.

thanks in adv.
Title: Re: is it possible to select the operation(<,>,=,<=,>=) dynamically & put in query
Post by: LDJB81 on 06 Mar 2013 09:24:31 AM
substitute and prompt macros

http://cognosknowhow.blogspot.fr/2012/06/how-to-achieve-dynamic-operator-using.html
Title: Re: is it possible to select the operation(<,>,=,<=,>=) dynamically & put in query
Post by: CognosPaul on 06 Mar 2013 03:38:27 PM
The macro in that example is needlessly complicated. There's no need for the substitution function, just put the prompt for the operator before the prompt for the value:

[Namespace].[Table].[Date] #prompt('pch','token')# #prompt('pdate','date')#
Title: Re: is it possible to select the operation(<,>,=,<=,>=) dynamically & put in query
Post by: everlearner on 07 Mar 2013 02:35:08 AM
ThanQ Paul & LDJ for ur reply.

i have put this one in query, but getting error.

[Namespace].
.[Date] #prompt('pch','token')# #prompt('pdate','date')#.

do i need to set any properties for my parameter pch???

thanks in adv

Title: Re: is it possible to select the operation(<,>,=,<=,>=) dynamically & put in query
Post by: CognosPaul on 07 Mar 2013 04:25:12 AM
There are millions of possible errors or warnings you might be receiving. Without seeing the error, there is very little I can do to help. Post the entirety of the error.