COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: spmaganti on 23 Oct 2013 11:20:50 AM

Title: Value Prompt - Expression in Use Value
Post by: spmaganti on 23 Oct 2013 11:20:50 AM
Dear All

I have a filter in my Query - #prompt('pTerms', 'token')#

The associated value prompt has the following use values and display values:

use value: [Terms] like [Terms ST], display value: ST
use value: [Terms] not like [Terms ST], display value: Not ST

The [Terms ST] data item contains an expression 'ST'

I'm not able to validate the report with the above. I'm getting an error message XQE-V5-0011. There is possibly something I'm doing wrong in the filter or in the use value.

I'm thinking the 'token' in the prompt returns the use value from the value prompt and evaluate like an expression? Not sure. Has anyone got any thoughts or ideas where I was doing wrong?

BR
Title: Re: Value Prompt - Expression in Use Value
Post by: blom0344 on 23 Oct 2013 01:38:11 PM
A filter expression evaluates to true or untrue. your filter expression does not use an equation. It would contain an operator like '=' , 'like' , '<' etc  ..
Title: Re: Value Prompt - Expression in Use Value
Post by: spmaganti on 23 Oct 2013 01:56:06 PM
OK understood. So my idea is fundamentally flawed. I shall do a workaround then. Thanks for the reply.

BR
Title: Re: Value Prompt - Expression in Use Value
Post by: MFGF on 24 Oct 2013 02:53:25 AM
Hi,

I would code my filter expression like this:

([Terms] like '%ST%' and ?pTerms? = 'a') OR ([Terms] not like '%ST%' and ?pTerms? = 'b')

Code your prompt with two use values - a and b, and include the desired display value for each use value (ie 'ST' and 'Not ST')

Cheers!

MF.
Title: Re: Value Prompt - Expression in Use Value
Post by: spmaganti on 24 Oct 2013 06:05:41 AM
Thanks MFGF

That's similar to what I have done:

(?pTerms? = 'ALL' and ([Terms] like '%')) or
(?pTerms? = 'ST' and ([Terms] like 'ST')) or
(?pTerms? = 'Not ST' and ([Terms] not like 'ST'))

The following also worked for me:

case
   when (?pTerms? = 'ST') then ([Terms] like 'ST')
   when (?pTerms? = 'Not ST') then ([Terms] not like 'ST')
   else ([Terms] like '%')
end

Glad I'm thinking on the same lines as you cognos Gurus ;-) Thanks again for your response.

BR
Title: Re: Value Prompt - Expression in Use Value
Post by: Gopinath on 25 Oct 2013 04:38:13 AM
There is nothing wrong with your filter (#prompt('pTerms', 'token')#) as it will replace the use value of your prompt and equates to either 'True' or 'False'.