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)
Get data source (a file) from url for generating the report
tbabut
Hi,<br />
<br />
I want to generate a report from file thats on the same server with a parameter in the url.<br />
<br />
Here is a code snippet from the rptdesign file that I'm trying with:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><data-sources>
<oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data Source" id="861">
<property name="FILELIST">/var/lib/tomcat5.5/webapps/birt-viewer/20000_alarm_list_1284125213.xml</property>
<method name="beforeOpen">
this.setExtensionProperty("FILELIST", "/var/lib/tomcat5.5/webapps/birt-viewer/" + "params["xmlfile"]");
</method>
</oda-data-source>
</data-sources></pre>
URL used:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>http://<hostname>:8180/birt-viewer/frameset?__report=alarm_list.rptdesign&__format=pdf&xmlfile=20000_alarm_list_1284125213.xml</pre>
But after trying this I get the following error response:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>+ org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "
this.setExtensionProperty("FILELIST", "/var/lib/tomcat5.5/webapps/birt-viewer/" + "params["xmlfile"]");
":
{1}.</pre>
I have to admit, that I am not really familiar with java or xml language. Perhaps you can help me out. Thanks in advance.
Find more posts tagged with
Comments
jhelbling
Hi tbabut,
As a quick check, try modifying "params["xmlfile"]" with "params['xmlfile']"
It might simply be a confusion with the "" ...
Hope it helps.
tbabut
Hi,<br />
<br />
with your modification I get the following response:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>[...]
java.net.MalformedURLException: no protocol: /var/lib/tomcat5.5/webapps/birt-viewer/params['xmlfile']
[...]</pre>
I've also tried this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.setExtensionProperty("FILELIST", "/var/lib/tomcat5.5/webapps/birt-viewer/" + params["xmlfile"]);</pre>
And the error response as before:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: Report parameter "xmlfile" does not exist
Script source: , line: 0, text:
__bm_beforeOpen(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: Report parameter "xmlfile" does not exist
Script source: , line: 0, text:
__bm_beforeOpen()
at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:853)
at org.eclipse.birt.data.engine.script.JSMethodRunner.runScript(JSMethodRunner.java:76)
at org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(DtEScriptExecutor.java:90)
... 79 more
Caused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: Report parameter "xmlfile" does not exist
Script source: , line: 0, text:
__bm_beforeOpen()</pre>
XavierR
<blockquote class='ipsBlockquote' data-author="'tbabut'" data-cid="68433" data-time="1284547666" data-date="15 September 2010 - 03:47 AM"><p>
<br />
Report parameter "xmlfile" does not exist !<br /></p></blockquote>
Hi,<br />
With : BIRT Context Sensitive Help Version: 2.6.1.v20100618-3507w31211924<br />
I created a report with an XML data source.<br />
<br />
1) add a new parameter : urlDataSource<br />
2) set the beforeOpen property of DataSource with<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>setExtensionProperty("FILELIST", params["urlDataSource"])</pre>
3) call the servlet viewer <br />
<a class='bbc_url' href='
http://localhost:8580/birt/frameset?__report=myreport.rptdesign&urlDataSource=http://localhost:8580/test/xmlstream-99999.data'>http://localhost:8580/birt/frameset?__report=myreport.rptdesign&urlDataSource=http://localhost:8580/test/xmlstream-99999.data</a><br
/>
<br />
where <a class='bbc_url' href='
http://localhost:8580/test/xmlstream-99999.data'>http://localhost:8580/test/xmlstream-99999.data</a>
; returns an XML stream.<br />
And it's work.