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)
Invalid Javascript Expression
koallen
I created a simple javascript expression in the Report Designer, the expression concatenates first name and Last name with an empty string in between to provide space between the names.
This runs fine in the designer, the check validates the expression and the dataset is displayed in preview with no issues.
I have now deployed the report in a war file as part of an application. Report generation fails with the following error:
INFO: org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details:
A BIRT exception occurred: Invalid javascript expression: row["firstName"]+" "+row["lastName"]. See next exception for more information.
Invalid javascript expression: row["firstName"]+" "+row["lastName"] class org.eclipse.birt.report.engine.api.EngineException
Any help would be appreciated.
Find more posts tagged with
Comments
mwilliams
Hi koallen,
Is there any more info with the error?
koallen
I obtain an IRunAndRenderTask from IReportEngine, the getErrors() method of the IRunAndRender object returns the message I reported, there are no other errors.
I also create a PDFRenderOption object and set the outputformat to PDFRenderOption.OUTPUT_FORMAT_PDF.
Please see the code below, I get the same error with HTMLRenderOption.
public PrintObject renderReport(PrintObject printobject, IReportEngine birtEngine){
try {
IReportRunnable openReportDesign = birtEngine.openReportDesign(printobject.getRealPath()+ "/" + getReportName());
IRunAndRenderTask createRunAndRenderTask = birtEngine.createRunAndRenderTask(openReportDesign);
PDFRenderOption renderOption = new PDFRenderOption();
// HTMLRenderOption renderOption = new HTMLRenderOption();
// renderOption.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
renderOption.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
ByteArrayOutputStream results = new ByteArrayOutputStream();
//Create App context
renderOption.setOutputStream(results);
createRunAndRenderTask.setRenderOption(renderOption);
createRunAndRenderTask.run();
printobject.setByteresults(results.toByteArray());
for(Object error :createRunAndRenderTask.getErrors()){
Logger.getLogger(BirtPrinters.class.getName()).log(Level.SEVERE,"print object errors: " + error.toString() + " " + error.getClass());
}
createRunAndRenderTask.close();
} catch (EngineException ex) {
Logger.getLogger(BirtPrinters.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
catch (Exception exception){
Logger.getLogger(BirtPrinters.class.getName()).log(Level.SEVERE, null, exception);
}
return printobject;
dzish
Hi,
I have similar problem. I have unit test which starts birt_runtime_2_5_1 and generate report.
Report is generated but instead of table it shows stacktrace. I suspect galimatias with js.jar library. Report is created in eclipse 3.5.1.r351_v20090810 and BIRT 2.5.1.v20090708. Both Eclipse a runtime are official releases.
I tried changed with newer one in "lib" and "plugins" directory but wihout effect. Which path is important for databinding? I think "lib" is used for my events and "plugins" is used by engine, am I right?
Is it important to have same versions of js.jar in eclipse and runtime?
Invalid javascript expression: dataSetRow["myColumn"]
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1163)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1127)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
at cz.billboard.bbelements.adserverreportingportal.report.BirtGlobalCampaignReportTest.testSimpleGlobalReportWithOnlySummary(BirtGlobalCampaignReportTest.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:607)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:517)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:669)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:956)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
at org.testng.TestRunner.runWorkers(TestRunner.java:759)
at org.testng.TestRunner.privateRun(TestRunner.java:592)
at org.testng.TestRunner.run(TestRunner.java:486)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
at org.testng.SuiteRunner.run(SuiteRunner.java:204)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877)
at org.testng.TestNG.runSuitesLocally(TestNG.java:842)
at org.testng.TestNG.run(TestNG.java:751)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124
mwilliams
Are you guys using Windows or Linux?
Maybe it doesn't like the double quotes. Try using just a single ' instead. See if that helps.
dzish
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71587" data-time="1292945644" data-date="21 December 2010 - 08:34 AM"><p>
Are you guys using Windows or Linux?<br />
<br />
Maybe it doesn't like the double quotes. Try using just a single ' instead. See if that helps.<br /></p></blockquote>
<br />
Hi,<br />
<br />
thank you for answer. I have Windows. Single ' doesn't help. I changed "dataSetRow['myColumn']" to simple number "1" wihout quotas. And exception appears.
mwilliams
In some searching around, it looks like others have had this issue because of the js.jar in the development environment being different than the one in their deployed WAR file. You might check this out and replace the deployed version to the version in your designer where your report is working fine.
hardiksawant
<p>Hi,</p>
<p>I too have same problem with BIRT</p>
<p>I am getting org.eclipse.birt.report.engine.api.EngineException: Invalid Javascript expression: Total.sum(row["QUANTITYORDERED"] * row["PRICEEACH"]).</p>
<p> </p>
<p>Where QUANTITYORDERED and PRICEEACH are my coulms and I want total of their sum.</p>
<p>Can anyone help me with this issue.</p>
<p> </p>
<p>I have used Classic Models(Sales Invoice) rpt to test .</p>
SkyfireYogita
Hii Michael Williams,
I want to change my reportdesign filename on Export report