COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: testuser on 21 Mar 2007 07:23:55 AM

Title: FM- Operator as a prompt
Post by: testuser on 21 Mar 2007 07:23:55 AM
I would like to create a prompt for an Operator sign - > or < or = or <> etc.
I will be using it as part of an SQL (Query subject) for example

select *
from
Ã,  Ã,  Ã,  Ã,  tablea
where
Ã,  Ã,  Ã,  Ã,  b promptA(< or > or = or <>) #prompt('Country')#.



Thanks,
Title: Re: FM- Operator as a prompt
Post by: MFGF on 26 Mar 2007 04:25:17 AM
Hi,

Why not just extend your expression to use another prompt macro for the operator as well?

For example:

select *
from
        tablea
where
        b.promptA #prompt('Operator','token','=')# #prompt('Country')#

Best regards,

MF
Title: Re: FM- Operator as a prompt
Post by: testuser on 27 Mar 2007 09:19:01 PM
Thank you for the reply. I will try that. But what would the datatype be - is token a string?
How do I go about storing > , <, = so that users could choose it from a drop down menu?

Thank you for your help
Title: Re: FM- Operator as a prompt
Post by: MFGF on 28 Mar 2007 03:00:34 AM
Hi,

The Token datatype is used where you want to pass the results of the prompt back as entered.  If you used a string datatype, the entered value would be encapsulated in quotes, which would not be legal syntax in this part of the expression.

To give the users a dropdown list of operators, you will need to add a value prompt to your report.  In the properties of the prompt, make sure it is connected to your 'Operator' parameter, and add static choices for each operator you want displayed.

Hope that helps,

MF.
Title: Re: FM- Operator as a prompt
Post by: COGNOiSe administrator on 28 Mar 2007 11:07:57 AM
You could also use compund filter, meanning

( #prompt('Choise')#=1 and Country>#prompt('Country')# )
or
( #prompt('Choise')#=2 and Country<#prompt('Country')# )
or
( #prompt('Choise')#=3 and Country=#prompt('Country')# )
or
( #prompt('Choise')#=4 and Country<>#prompt('Country')# )
Title: Re: FM- Operator as a prompt
Post by: testuser on 29 Mar 2007 03:38:33 PM
Thank you all. I was able to get the report working. Appreciate all your help.