Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Change data source from program code
R2D4
Hello all,<br />
<br />
I'm quite new to BIRT and trying some stuff. I've build a report design (from Eclipse) and attached it to an XML data source. That works like a charm. I've also integrated BIRT with a simple Java application, which also works.<br />
<br />
Now I want to make the data source variable, as I have an XML database (with identically structured XML files) from which I want to generate reports. From my source I want to change the data source stored in the rptdesign.<br />
<br />
How can I do that?<br />
<br />
Example from .rptdesign :<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<data-sources>
<oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="[eXist] (tryout)" id="8">
<property name="FILELIST">http://localhost:8080/exist/rest//db/tryout.xml</property>
</oda-data-source>
</data-sources>
</pre>
<br />
Thanks!
Find more posts tagged with
Comments
JasonW
Are you just wanting to change the xml location ie the FILELIST property? You should be able to do this with script or property binding.<br />
This page shows how to change jdbc values<br />
<a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/examples/reports/birt2.1/querymod/index.php'>BIRT
Example Reports</a><br />
<br />
In your case you want to change the FILELIST property.<br />
<br />
so in the beforeOpen script try:<br />
this.setExtensionProperty("FILELIST", "mynewlocation");<br />
<br />
Jason
R2D4
<blockquote class='ipsBlockquote' data-author="JasonW"><p>Are you just wanting to change the xml location ie the FILELIST property? You should be able to do this with script or property binding.<br />
This page shows how to change jdbc values<br />
<a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/examples/reports/birt2.1/querymod/index.php'>BIRT
Example Reports</a><br />
<br />
In your case you want to change the FILELIST property.<br />
<br />
so in the beforeOpen script try:<br />
this.setExtensionProperty("FILELIST", "mynewlocation");<br />
<br />
Jason</p></blockquote>
<br />
Hi Jason,<br />
<br />
Thanks for your help!<br />
<br />
Indeed, I found that the property binding of the XML data source is what I need.<br />
<br />
I'm getting somewhere, but I'm not really there yet. I've added a parameter to the property binding. At runtime, I set this parameter with the URI of the XML file. That works fine! Also, the report renders just fine, but, without any data.<br />
<br />
When I run the report design from Eclipse, without the property binding configured, my report renders fine, including all data. However, as soon as I configure the property binding, I cannot run the report from Eclipse anymore (not even when setting the default value of the paramater for the property binding to an existing, correct, XML file). Perhaps this is standard behavior (because of the overridden data source?)?. <br />
<br />
Where should I start to look?<br />
<br />
Best, R
JasonW
Property Binding only happens when you run the report and should work in the designer as long as the designer has access to what you changed in the datasource. What error are you getting?
Jason
R2D4
<blockquote class='ipsBlockquote' data-author="JasonW"><p>Property Binding only happens when you run the report and should work in the designer as long as the designer has access to what you changed in the datasource. What error are you getting?<br />
<br />
Jason</p></blockquote>
<br />
Hi Jasom<br />
<br />
The thing is... I didn't get any fancy error... just "error". I found out this was due to some bad report; any other report with parameters just works fine. <br />
<br />
Best, R