Hi,
Is it possible to set dynamically a database connection with a report parameter ?
For example, choosing the database name with a drop down (String parameter) and setting dynamically the JDBC connection ?
Thanks
Hi,
Is it possible to set dynamically a database connection with a report parameter ?
For example, choosing the database name with a drop down (String parameter) and setting dynamically the JDBC connection ?
Thanks
Sylvain
http://www.osbi.fr
Yes.
1. Create two queries.
2. Create another query to hold the list of possible queries. For example, I created a table data source to hold query names.
3. Create a parameter. The query for the parameter should be the query from step two above.
4. On the Structure tab, select Master Report.
5. Select the Attributes tab.
6. For query > name, select the Expression button (+).
7. In the Edit Expression dialog, add the following:
=[myQuery]
Where myQuery is the name of the parameter that you created in step three above.
Hi
Thank you very much !
It's not exactly my use case (i have 2 different database connections, but queries are the same; i only want to parameter the database host name)
But your method is a good way to do
I've found another one => using a kettle datasource, and passing hostname as a drop down parameter from PRD (in PDI, host and database names accept ${} syntax )
Sylvain
http://www.osbi.fr
Of course, if you use PRD-3.9, then you have the full power of the scripting API at your hands. In the "init()" method you have access to the datafactory instance *before* it has been used. So you can reconfigure the connection (as long as you stick to the same type (JNDI to JNDI, or manual connection to manual connection)) using the parameter that come in.
Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.