I am trying to transpose sample code from a BIRT report design using the BIRT sample database. The technique is a Render of the report document to an ODT format then post to a directory for later printing. This is utilizing BIRT 4.3.1. for Maximo 7.6.0.5
Here is the code I am trying to transpose: In the BIRT .rptdesign afterFactory()
importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> re: " + re);
}
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> reportContext: " + reportContext);
}
design = reportContext.openReportDesign(document.getReportRunnable().getReportName());
var ntask = re.createRunAndRenderTask(design);
ntask.validateParameters();
var options = new RenderOption();
var outputfile = "c:\\temp\\test_" + this.getRowData().getColumnValue(0) + ".txt"
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> outputfile: " + outputfile);
}
options.setOutputFileName(outputfile);
options.setOutputFormat("odt");
ntask.setRenderOption(options);
ntask.run();
ntask.close();
MXReportScriptContext.close();
In the generated log file this is the error seen:
20 Apr 2017 13:00:58:300 [INFO] DataSet [dataSet]: SELECT po.ponum, matrectrans.ponum, matrectrans.polinenum, poline.linetype, poline.itemnum, poline.description, matrectrans.quantity, poline.orderunit, matrectrans.siteid, matrectrans.conversion, COALESCE(matrectrans.zxqlabelqty,1) AS zxqlabelqty, (select alndomain.description from alndomain where alndomain.domainid='ZXQPRINTERNAME' and ((alndomain.value = '15'))) AS lblFormatPrntr FROM po, matrectrans, poline WHERE matrectrans.ponum = po.ponum AND matrectrans.positeid = po.siteid AND poline.siteid = po.siteid AND poline.ponum = po.ponum AND matrectrans.polinenum = poline.polinenum AND matrectrans.issuetype in (select value from synonymdomain where domainid = 'ISSUETYP' and maxvalue = 'RECEIPT') AND ( po.internal = 0) and ( ( po.poid = 1192 ) )
20 Apr 2017 13:00:58:316 [INFO] DataSet [dataSet] close called.
20 Apr 2017 13:00:58:316 [DEBUG] >>> re: org.eclipse.birt.report.engine.api.impl.ReportEngine@6813a3e6
20 Apr 2017 13:00:58:316 [DEBUG] >>> reportContext: org.eclipse.birt.report.engine.script.internal.ReportContextImpl@3d9358b8
20 Apr 2017 13:00:58:347 [ERROR] ReportRequestFilter, Errorcode:500Error Description:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault>
<faultcode>BirtRunReportActionHandler.__execute()</faultcode><faultstring>
org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "
importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> re: " + re);
}
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> reportContext: " + reportContext);
}
design = reportContext.getEngine().openReportDesign(document.getReportRunnable().getReportName());
var ntask = re.createRunAndRenderTask(design);
ntask.validateParameters();
var options = new RenderOption();
var outputfile = "c:\\temp\\test_" + this.getRowData().getColumnValue(0) + ".txt"
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> outputfile: " + outputfile);
}
options.setOutputFileName(outputfile);
options.setOutputFormat("odt");
ntask.setRenderOption(options);
ntask.run();
ntask.close();
MXReportScriptContext.close();"
:
TypeError: Cannot find function getEngine in object org.eclipse.birt.report.engine.script.internal.ReportContextImpl@3d9358b8.
(/report/method[@name="afterFactory"]#11)
</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">VMMAX</ns1:hostname><string>org.eclipse.birt.report.engine.api.EngineException:
There are errors evaluating script "
importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> re: " + re);
}
i
f(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> reportContext: " + reportContext);
}
design = reportContext.getEngine().openReportDesign(document.getReportRunnable().getReportName());
var ntask = re.createRunAndRenderTask(design);
ntask.validateParameters();
var options = new RenderOption();
var outputfile = "c:\\temp\\test_" + this.getRowData().getColumnValue(0) + ".txt"
if(scriptLogger.isDebugEnabled()) {
scriptLogger.debug(" >>> outputfile: " + outputfile);
}
options.setOutputFileName(outputfile);
options.setOutputFormat("odt");
ntask.setRenderOption(options);
ntask.run();
ntask.close();
MXReportScriptContext.close();"
:
TypeError: Cannot find function getEngine in object org.eclipse.birt.report.engine.script.internal.ReportContextImpl@3d9358b8. (/report/method[@name="afterFactory"]#11)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:249)
at org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleAfterFactory(ReportScriptExecutor.java:149)
at org.eclipse.birt.report.engine.api.impl.EngineTask.closeFactory(EngineTask.java:2041)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:282)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:86)
at org.eclipse.birt.report.service.ReportEngineService.runReport(ReportEngineService.java:1344)
at org.eclipse.birt.report.service.BirtViewerReportService.runReport(BirtViewerReportService.java:158)
at org.eclipse.birt.report.service.actionhandler.BirtRunReportActionHandler.__execute(BirtRunReportActionHandler.java:81)
at org.eclipse.birt.report.service.actionhandler.BirtGetPageActionHandler.__checkDocumentExists(BirtGetPageActionHandler.java:58)
Thank you for your time.