COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: mprof on 19 Dec 2013 04:59:33 AM

Title: text box prompt
Post by: mprof on 19 Dec 2013 04:59:33 AM
can i put multiple values into a text box prompt?

for example:

I would like to enter the values: 5,7,23. into a prompt box (parameter is par1)

and the query is

select price from groceries
where id in ((#prompt('par1')#)).

I want the query to be:
select proce from groceries
where in in (5,7,23).

can i do this way?

thanks
Michael
Title: Re: text box prompt
Post by: MFGF on 19 Dec 2013 05:23:02 AM
Hi,

Assuming ID is numeric, this should work:

select price from groceries
where id in (#prompt('par1','token','1')#)

MF.
Title: Re: text box prompt
Post by: mprof on 19 Dec 2013 05:27:18 AM
thanks a lot  :)

is there maybe a way to do the same but with string values?
let's say... 'orange','soap','tomato'

thanks
Title: Re: text box prompt
Post by: MFGF on 19 Dec 2013 05:32:23 AM
Let's take a step back for a moment. Why would you want to get users to manually type things like this into a text box prompt (with the huge risk they could mis-spell a value or even enter something that doesn't exist)? Wouldn't a value prompt be far more friendly? Is there any particular reason why you are manually coding SQL anyway rather than defining a simple filter in the report?

Cheers!

MF.

Title: Re: text box prompt
Post by: mprof on 19 Dec 2013 05:40:59 AM
actually this demand came from the users.
the have a list of several thousand items, and they want to choose only several of them in one query (for example 10 different items).
to give them a multiple choice is not very useful because the items are different each time and to search for them in the list takes to much time.
I'm aware that they may misspell or make other mistakes, but it is the most dynamic solution I could think of.
Title: Re: text box prompt
Post by: mprof on 19 Dec 2013 06:03:59 AM
is there a way to do so in report studio directly without using sql coding?
Title: Re: text box prompt
Post by: MFGF on 19 Dec 2013 08:07:10 AM
How about a Select and Search prompt? Users enter all or part of a name and choose one or more items from the list of hits. They can then search for something else and choose some more...

That surely has to be better than relying on them to type in accurate names?

You don't need SQL - just add a detail filter coded with an expression of [Item name] in ?Some Parameter name of your choice?

Cheers!

MF.