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)
If condition, error
freedomsim
Hi I am trying to create a hyperlink between two reports. When I transmit one of the parameters from my report to the linked report, I am using the following expression:
if (params["PARAM2"]=="Device Group")
{
if (row["HEADER"].substr(0,8)=="Others: ")
{
row["HEADER"].substr(8,row["HEADER"].length);
}
else
{
row["HEADER"];
}
}
else
{
params["PARAM5"];
}
But when I run my report I receive the following error:
Data (id = 410):
+ There are errors evaluating script: (here is the scipt that is in the upper part).
The interesting part is that the script is working, the functionality is ok, all the conditions are ok.
I think that is a syntax error but i just can not see it.
Thanks a lot,
Simona
Find more posts tagged with
Comments
mwilliams
Hi Simona,
When you click on the '+' by the error, what does it say it's caused by? Can you include the entire error message?
freedomsim
Hi, thi sis the error:
The following items have errors:
Data (id = 410):
- There are errors evaluating script
Error.ScriptEvaluationError ( 13 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException:
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:556)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:528)
at org.eclipse.birt.report.engine.executor.ReportItemExecutor.evaluate(ReportItemExecutor.java:222)
at org.eclipse.birt.report.engine.executor.ReportItemExecutor.processAction(ReportItemExecutor.java:324)
at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:84)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:35)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:63)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:94)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutChildren(HTMLInlineStackingLM.java:138)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout(HTMLRowLM.java:30)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
at org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.layoutChildren(HTMLTableBandLM.java:67)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:74)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:94)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutChildren(HTMLInlineStackingLM.java:138)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout(HTMLRowLM.java:30)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildren(HTMLBlockStackingLM.java:68)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:74)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:159)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layoutChildren(HTMLPageLM.java:139)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:81)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:80)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:194)
at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(Unknown Source)
at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(Unknown Source)
at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(Unknown Source)
at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(Unknown Source)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(Unknown Source)
at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(Unknown Source)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(Unknown Source)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Unknown Source)
at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:481)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.mozilla.javascript.EvaluatorException: syntax error (<inline>#1)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:95)
at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:82)
at org.mozilla.javascript.Parser.addError(Parser.java:120)
at org.mozilla.javascript.Parser.reportError(Parser.java:126)
at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2009)
at org.mozilla.javascript.Parser.memberExpr(Parser.java:1637)
at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1500)
at org.mozilla.javascript.Parser.mulExpr(Parser.java:1429)
at org.mozilla.javascript.Parser.addExpr(Parser.java:1410)
at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1390)
at org.mozilla.javascript.Parser.relExpr(Parser.java:1364)
at org.mozilla.javascript.Parser.eqExpr(Parser.java:1320)
at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1309)
at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1298)
at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1287)
at org.mozilla.javascript.Parser.andExpr(Parser.java:1275)
at org.mozilla.javascript.Parser.orExpr(Parser.java:1263)
at org.mozilla.javascript.Parser.condExpr(Parser.java:1246)
at org.mozilla.javascript.Parser.assignExpr(Parser.java:1228)
at org.mozilla.javascript.Parser.expr(Parser.java:1217)
at org.mozilla.javascript.Parser.statementHelper(Parser.java:1148)
at org.mozilla.javascript.Parser.statement(Parser.java:616)
at org.mozilla.javascript.Parser.parse(Parser.java:347)
at org.mozilla.javascript.Parser.parse(Parser.java:287)
at org.mozilla.javascript.Context.compileImpl(Context.java:2349)
at org.mozilla.javascript.Context.compileString(Context.java:1372)
mwilliams
Simona,
I don't see anything wrong with the syntax either. You say the report is running just fine, but it's still giving this error? Maybe it doesn't like the "row["HEADER"].length" in the substr() function. Don't know why it wouldn't, but it's just something to try I guess.
freedomsim
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Simona,<br />
<br />
I don't see anything wrong with the syntax either. You say the report is running just fine, but it's still giving this error? Maybe it doesn't like the "row["HEADER"].length" in the substr() function.</p></blockquote>
<br />
Hi,<br />
<br />
Yes the report is working just fine. As i saw, after I tried multiple variants i saw that may be a problem with: if { if {true;}else {false;}} else {}. If i try something like this if{}else {{true;}else {false;}} is ok...but still I think the syntax is ok like that. The think is i need the first syntax.<br />
<br />
Anyway thanks a lot,<br />
Simona.
mwilliams
Simona,<br />
<br />
So, if you use the following, it works just fine?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (params["PARAM2"]!="Device Group")
{
params["PARAM5"];
}
else
{
if (row["HEADER"].substr(0,8)=="Others: ")
{
row["HEADER"].substr(8,row["HEADER"].length);
}
else
{
row["HEADER"];
}
}
</pre>
<br />
I don't see why that would be. Good luck.
freedomsim
Hi,
I have discovered the following error for this part of code:
if (params["PARAM2"]!="Device Group")
{
params["PARAM5"];
}
else
{
if (row["HEADER"].substr(0,8)=="Others: ")
{
row["HEADER"].substr(8,row["HEADER"].length);
}
else
{
row["HEADER"];
}
}
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "substr" of null (<inline>#3)
Can please let me know why row["HEADER"] value is null in the first place and how can I change that?
Thanks a lot,
Simona.
mwilliams
Simona,
I'm not sure why that would be happening. Especially without being able to test it on my own. You could try putting a check for row["Header"] = null in the outer else{} somewhere to avoid that condition.