Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Dynamic Datasource/Dataset access
ayyalaraj
Hi,
I am trying to develop reports that are generated completely dynamic. As I am new to BIRT, I am wondering whether I can do this or not. My scenario is like this:
User will come to view reports based on his id, ex. client id. I will get this id from session. I need to generate reports based on this id. I also need to connect to respective database based on this id. I mean, my database is not static for creating Datasource and use it. I need to generate the datasource information on the fly and generate the reports.
I am thinking it is possible using JNDI URL and other stuff. But I don't know whether it is possible in BIRT or not.
Is it possible to create datasource or dataset dynamically? If yes, how can I acheive that in BIRT.... Please help....
Thanks in advance...
Chandrasekhar
Find more posts tagged with
Comments
averma
Hi Chandrasekhar:<br />
You can take a programmatic approach in your application to create a new BIRT design using <a class='bbc_url' href='
http://www.birt-exchange.com/documentation/BIRT_220/EngineJavadoc/model/api/index.html'>BIRT
Report Object Model</a> API. If your application requires changing only the data source information or even minor changes in an existing BIRT design based on the logged in user, you may consider modifying that design file using ROM API's. <br />
Starting with version 2.1 BIRT has expanded on the capabilities of the JDBC Data Source, by adding the option to specify a JNDI Name to look up a data source name service for retrieving a pooled connection.<br />
<br />
<br />
Ashwini
ayyalaraj
HI Ashwini,
Thanks for your reply. By anychance do you have any sample code or example? Please pass it on if you have any....
Thanks,
Chandrasekhar
Virgil Dodson
Hi ayyalaraj,<br />
<br />
There is an example that creates a report dynamically in the beforeFactory event of the report using scripting based on parameters passed in if you need that level of flexibility<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=117'>http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=117</a><br
/>
<br />
Otherwise, if you are just trying to change the connection information for the datasource, you can do that in the property binding for the data source.<br />
<br />
For example, you could dynamically accept the username by creating a parameter and then using that parameter in the property binding tab of the data source like below.<br />
<br />
params["passed_in_username"]
ayyalaraj
Hi Virgil,<br />
Thanks for your reply and I am trying both the methods, but could not able to do it. <br />
I am getting the datacube doesnot exist error in both the cases. <br />
<br />
I am herewith giving the error messages as well as the steps followed. Please let me know whether I am doing correct. <br />
<br />
My requirement is to change the datbase name depending on the client id. So, I am doing property binding in datasource section for JDBC Driver URL section like below.<br />
<br />
<em class='bbc'>if(params["client_id"] == "1002") {<br />
dbstring = "jdbc:sqlserver://hostname:port;databaseName=STDAPP05" ;<br />
}else {<br />
dbstring = "jdbc:sqlserver://hostname:port;databaseName=METRODEV" ;<br />
}<br />
dbstring;</em><br />
It is connecting to the proper database, but it is giving error while accessing db. For one db it is working, but for other db it is giving the following error. <br />
<br />
<em class='bbc'>The following items have errors: <br />
<br />
ReportDesign (id = 1): <br />
- /olap/cube_Data Cube doesnt exist <br />
/olap/cube_Data Cube doesn't exist ( 1 time(s) )<br />
detail : org.eclipse.birt.data.engine.core.DataException: /olap/cube_Data Cube doesnt exist at org.eclipse.birt.data.engine.olap.impl.query.CubeQueryResults.getCubeCursor(CubeQueryResults.java:91)</em><br />
<br />
Same is the case when I try to run the script in beforeFactory event. <br />
<br />
Kindly tell me whether I am doing correct or not?<br />
<br />
Thanks,<br />
Chandrasekhar
A.ASIKRAJA
<p><a class="bbc_url" href="
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=117"
; title="External link">
http://www.birt-exch...p?cid=2&lid=117</a>;</p><p>This
link is not working....Please check this.where i can see the info of that link</p>