COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Cognos Connection, Viewer, Scheduler => Topic started by: stancho on 01 Jul 2015 04:23:17 AM

Title: & in parameter value when passing the parameter through URL
Post by: stancho on 01 Jul 2015 04:23:17 AM
Hi all,

I'm invoking my report skipping the prompt page and passing some parameters through URL.
One of my dimensions which needs to be filtered by parameter in the URL contains a value which includes & in it.
Ex. 'A&B'.

How can I pass this value in the url?
I tried the following:
p_MyParam=<selectChoices><selectOption>useValue='A&B'/></selectChoices>
p_MyParam=<selectChoices><selectOption>useValue="A&B"/></selectChoices>
p_MyParam=<selectChoices><selectOption>useValue=A&B/></selectChoices>
p_MyParam=<selectChoices><selectOption>useValue='A%26B'/></selectChoices>
p_MyParam=<selectChoices><selectOption>useValue="A%26B"/></selectChoices>
p_MyParam=<selectChoices><selectOption>useValue=A%26B/></selectChoices>

but all of these seems to make the report skipping this filter.

Any ideas?

Thanks,
Stancho
Title: Re: & in parameter value when passing the parameter through URL
Post by: bdbits on 06 Jul 2015 09:41:10 AM
I think you are saying you want to pass the value of the parameter in the URL? Parameters in the URL are usually just name/value pairs, though you do have to escape 'special' characters like the ampersand.

This should suffice: p_MyParam=A%26B
Title: Re: & in parameter value when passing the parameter through URL
Post by: stancho on 06 Jul 2015 01:12:24 PM
Hi bdbits,

thanks for your reply!

That could be ok, but the this filter is required to be multi-select. So several values should be able to be passed.
Title: Re: & in parameter value when passing the parameter through URL
Post by: bdbits on 08 Jul 2015 05:35:36 PM
You just repeat the parameter name with more values, e.g. &p_MyParam=firstvalue&p_MyParam=secondvalue&p_MyParam=thirdvalue

Here is an older post on the topic which still works in current versions, and there is information in the product documentation (particularly SDK).

http://www.cognoise.com/index.php?topic=13670.0 (http://www.cognoise.com/index.php?topic=13670.0)
Title: Re: & in parameter value when passing the parameter through URL
Post by: stancho on 23 Jul 2015 09:13:32 AM
bdbits,
it's working using this syntax.

Thanks a lot!
Title: Re: & in parameter value when passing the parameter through URL
Post by: bdbits on 23 Jul 2015 09:50:47 AM
You're welcome.  :D