COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: kkrobinson on 28 Dec 2011 09:26:06 AM

Title: How do I dynamically set parameters?
Post by: kkrobinson on 28 Dec 2011 09:26:06 AM
Hi,

This may be a very simple question, but I'm fairly new to RS.

I'm calling an RS report using a parameterized URL and passing in the value for the parameter p_rptId.  Using this parameter I need to run a query against the database to return the report name and some other values.  The query looks like this:
select rpt_name, val1, val2, val3 from rpt_info where rpt_id = ?rptId?" and since rpt_id is the primary key I know I'll only get back one record.

The result looks like this:
rpt_name            val1 val2   val3
--------------------- ----- ----- -------
Cashier Report    X      Y     Z

I need to use the rpt_name, val1, val2, and val3 returned values throughout the prompt pages in the RS report.  I know I can use a value prompt and then, using Javascript, grab the data value, but was hoping to do this w/o Javascript.

1. Is there a cleaner way to do this without Javascript?  I would need to be able to access the four values returned in the one record from the database.

Thanks in advance for your help.

Keith
Title: Re: How do I dynamically set parameters?
Post by: CognosPaul on 02 Jan 2012 02:55:30 AM
If you're trying to stay away from JavaScript, you could try using a parameter map. You'll need to set up four parameter maps, one for each value, with the key as the rpt_id. Then you could reference it in the queries as #$rpt_nameLookup{prompt('rptId','string')}#
Title: Re: How do I dynamically set parameters?
Post by: kkrobinson on 11 Jan 2012 09:59:38 AM
Thanks.  I'll give that a try, but I was hoping to grab the data from a table to make it dynamic.
Title: Re: How do I dynamically set parameters?
Post by: CognosPaul on 12 Jan 2012 03:38:20 AM
You can set a parameter map to look at a table.