Hello, I'm new to Birt.
I'm trying to pass the connection to the report from my java application, but I get an error:
The following items have errors:
ReportDesign (id = 1):
+ There are errors evaluating script "importPackage(Packages.it.lfiammetta.birt);
var conn = new ReportRenderer();
reportContext.getAppContext().put("OdaJDBCDriverPassInConnection", conn);":
Fail to execute script in function __bm_beforeOpen(). Source:
------
" + importPackage(Packages.it.lfiammetta.birt);
var conn = new ReportRenderer();
reportContext.getAppContext().put("OdaJDBCDriverPassInConnection", conn); + "
-----
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError: "ReportRenderer" is not defined. (/report/data-sources/oda-data-source[@id="43"]/method[@name="beforeOpen"]#2)
Script source: /report/data-sources/oda-data-source[@id="43"]/method[@name="beforeOpen"], line: 0, text:
__bm_beforeOpen(). (Element ID:1)
This is my java code that creates and launches report:
This is the code I wrote in the script 'beforeOpen' the datasource:
I set the classpath.
Birt version I'm using is 4.2.1.
Thanks in advance for your help and I apologize for my English.
I'm trying to pass the connection to the report from my java application, but I get an error:
The following items have errors:
ReportDesign (id = 1):
+ There are errors evaluating script "importPackage(Packages.it.lfiammetta.birt);
var conn = new ReportRenderer();
reportContext.getAppContext().put("OdaJDBCDriverPassInConnection", conn);":
Fail to execute script in function __bm_beforeOpen(). Source:
------
" + importPackage(Packages.it.lfiammetta.birt);
var conn = new ReportRenderer();
reportContext.getAppContext().put("OdaJDBCDriverPassInConnection", conn); + "
-----
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError: "ReportRenderer" is not defined. (/report/data-sources/oda-data-source[@id="43"]/method[@name="beforeOpen"]#2)
Script source: /report/data-sources/oda-data-source[@id="43"]/method[@name="beforeOpen"], line: 0, text:
__bm_beforeOpen(). (Element ID:1)
This is my java code that creates and launches report:
package it.lfiammetta.birt; public class ReportRenderer { public void executeReport() { code... Map<String, Object> appContext = task.getAppContext(); appContext.put("OdaJDBCDriverPassInConnection", myConnection); appContext.put("OdaJDBCDriverPassInConnectionCloseAfterUse", false); task.setAppContext(appContext); task.run(); code... } }
This is the code I wrote in the script 'beforeOpen' the datasource:
importPackage(Packages.it.lfiammetta.birt); var conn = new ReportRenderer(); reportContext.getAppContext().put("OdaJDBCDriverPassInConnection", conn);
I set the classpath.
Birt version I'm using is 4.2.1.
Thanks in advance for your help and I apologize for my English.