Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » org.mozilla.javascript.EcmaError: ReferenceError: "Total" is not defined
org.mozilla.javascript.EcmaError: ReferenceError: "Total" is not defined [message #685358] Fri, 17 June 2011 10:39 Go to next message
tong123123 tong123123 is currently offline tong123123 tong123123Friend
Messages: 74
Registered: April 2011
Member
My birt designer version is 2.2.1.r221_v20070924

I know birt designer has a Total class from the following link

http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/org.eclipse.birt.doc/birt/birt-24-4.html

but in my report, dataset afterOpen event, I write
Packages.java.lang.System.out.println("afterOpen, Total.ave(row[\"AVG_%_Total_Processor_Time\"] " + 
Total.ave(row["AVG_%_Total_Processor_Time"]));

and there is error shown in eclipsec.exe console as following
2011年6月17日 下午06:18:16 org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor handleJS
警告: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: ReferenceError: "Total" is not defined. (DataSet[CPU_Uni
x].__bm_afterOpen#2)
 Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
__bm_afterOpen(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError: "Total" is not defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
 Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
__bm_afterOpen()
org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: ReferenceErro
r: "Total" is not defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
 Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
__bm_afterOpen(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError: "Total" is not defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
 Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
__bm_afterOpen()
        at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
        at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:680)
        at org.eclipse.birt.data.engine.script.JSMethodRunner.runScript(JSMethodRunner.java:79)
        at org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(DtEScriptExecutor.java:71)
        at org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.handleJS(DataSetScriptExecutor.java:159)
        at org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.handleAfterOpen(DataSetScriptExecutor.java:104)
        at org.eclipse.birt.data.engine.impl.DataSetRuntime.afterOpen(DataSetRuntime.java:535)
        at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:333)
        at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:767)
        at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:217)
        at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:157)
        at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:83)
        at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:155)
        at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:111)
        at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:182)
        at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.executeQueries(ExtendedGenerateExecutor.java:197)
        at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.execute(ExtendedGenerateExecutor.java:63)
        at org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:60)
        at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:45)
        at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:45)
        at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:42)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:63)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
        at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:95)
        at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:135)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:68)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
        at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:76)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:68)
        at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:85)
        at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:106)
        at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:189)
        at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:224)
        at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:89)
        at org.eclipse.birt.report.service.ReportEngineService.runReport(Unknown Source)
        at org.eclipse.birt.report.service.BirtViewerReportService.runReport(Unknown Source)
        at org.eclipse.birt.report.service.actionhandler.BirtRunReportActionHandler.__execute(Unknown Source)
        at org.eclipse.birt.report.service.actionhandler.BirtChangeParameterActionHandler.runReport(Unknown Source)
        at org.eclipse.birt.report.service.actionhandler.AbstractChangeParameterActionHandler.__execute(Unknown Source)
        at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(Unknown Source)
        at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(Unknown Source)
        at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(Unknown Source)
        at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleChangeParameter(Unknown Source)
        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.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(Unknown Source)
        at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
        at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.eclipse.birt.report.filter.ViewerFilter.doFilter(Unknown Source)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: ReferenceError: "Total" is not
defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
 Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
__bm_afterOpen()
        at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:287)
        at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:102)
        at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScript(JavascriptEvalUtil.java:134)
        at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:676)
        ... 101 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "Total" is not defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3240)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3230)
        at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3303)
        at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1632)
        at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1571)
        at org.mozilla.javascript.gen.c1272._c1(DataSet[CPU_Unix].__bm_afterOpen:2)
        at org.mozilla.javascript.gen.c1272.call(DataSet[CPU_Unix].__bm_afterOpen)
        at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:105)
        at org.mozilla.javascript.gen.c1273._c0(DataSet[CPU_Unix].__bm_afterOpen:1)
        at org.mozilla.javascript.gen.c1273.call(DataSet[CPU_Unix].__bm_afterOpen)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
        at org.mozilla.javascript.gen.c1273.call(DataSet[CPU_Unix].__bm_afterOpen)
        at org.mozilla.javascript.gen.c1273.exec(DataSet[CPU_Unix].__bm_afterOpen)
        at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:95)
        ... 103 more


why the error message said "Total" is not defined??

also, there is computed column which called
Total.ave(row["AVG_%_Total_Processor_Time"])


but all return null even though row["AVG_%_Total_Processor_Time"] is not null, is this related to the "Total" class not found?

Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #685451 is a reply to message #685358] Fri, 17 June 2011 14:30 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try this on a table detail row's onCreate? Row values will not
be populated in afterOpen.

Jason

On 6/17/2011 6:40 AM, forums-noreply@eclipse.org wrote:
> My birt designer version is 2.2.1.r221_v20070924
>
> I know birt designer has a Total class from the following link
>
> http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/org.eclipse.birt.doc/birt/birt-24-4.html
>
>
> but in my report, dataset afterOpen event, I write
>
> Packages.java.lang.System.out.println("afterOpen,
> Total.ave(row[\"AVG_%_Total_Processor_Time\"] " +
> Total.ave(row["AVG_%_Total_Processor_Time"]));
>
> and there is error shown in eclipsec.exe console as following
>
> 2011年6月17日 下午06:18:16
> org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor handleJS
> 警告: A BIRT exception occurred: Error evaluating Javascript expression.
> Script engine error: ReferenceError: "Total" is not defined.
> (DataSet[CPU_Uni
> x].__bm_afterOpen#2)
> Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
> __bm_afterOpen(). See next exception for more information.
> Error evaluating Javascript expression. Script engine error:
> ReferenceError: "Total" is not defined.
> (DataSet[CPU_Unix].__bm_afterOpen#2)
> Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
> __bm_afterOpen()
> org.eclipse.birt.data.engine.core.DataException: A BIRT exception
> occurred: Error evaluating Javascript expression. Script engine error:
> ReferenceErro
> r: "Total" is not defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
> Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
> __bm_afterOpen(). See next exception for more information.
> Error evaluating Javascript expression. Script engine error:
> ReferenceError: "Total" is not defined.
> (DataSet[CPU_Unix].__bm_afterOpen#2)
> Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
> __bm_afterOpen()
> at
> org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
>
> at
> org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:680)
>
> at
> org.eclipse.birt.data.engine.script.JSMethodRunner.runScript(JSMethodRunner.java:79)
>
> at
> org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(DtEScriptExecutor.java:71)
>
> at
> org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.handleJS(DataSetScriptExecutor.java:159)
>
> at
> org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.handleAfterOpen(DataSetScriptExecutor.java:104)
>
> at
> org.eclipse.birt.data.engine.impl.DataSetRuntime.afterOpen(DataSetRuntime.java:535)
>
> at
> org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:333)
>
> at
> org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:767)
>
> at
> org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:217)
>
> at
> org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:157)
>
> at
> org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:83)
>
> at
> org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:155)
>
> at
> org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:111)
>
> at
> org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:182)
>
> at
> org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.executeQueries(ExtendedGenerateExecutor.java:197)
>
> at
> org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.execute(ExtendedGenerateExecutor.java:63)
>
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:60)
>
> at
> org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:45)
>
> at
> org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:45)
>
> at
> org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:42)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:63)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:95)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:135)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:68)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:76)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:68)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:85)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:106)
>
> at
> org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:189)
>
> at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:224)
> at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:89)
> at org.eclipse.birt.report.service.ReportEngineService.runReport(Unknown
> Source)
> at
> org.eclipse.birt.report.service.BirtViewerReportService.runReport(Unknown Source)
>
> at
> org.eclipse.birt.report.service.actionhandler.BirtRunReportActionHandler.__execute(Unknown
> Source)
> at
> org.eclipse.birt.report.service.actionhandler.BirtChangeParameterActionHandler.runReport(Unknown
> Source)
> at
> org.eclipse.birt.report.service.actionhandler.AbstractChangeParameterActionHandler.__execute(Unknown
> Source)
> at
> org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleChangeParameter(Unknown
> Source)
> 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.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(Unknown
> Source)
> at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
>
> at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
>
> at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
> at
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> at
> org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(Unknown
> Source)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>
> at org.eclipse.birt.report.filter.ViewerFilter.doFilter(Unknown Source)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>
> at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>
> at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>
> at
> org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
>
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
>
> at java.lang.Thread.run(Thread.java:662)
> Caused by: org.eclipse.birt.core.exception.CoreException: Error
> evaluating Javascript expression. Script engine error: ReferenceError:
> "Total" is not
> defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
> Script source: DataSet[CPU_Unix].__bm_afterOpen, line: 1, text:
> __bm_afterOpen()
> at
> org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:287)
>
> at
> org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:102)
>
> at
> org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScript(JavascriptEvalUtil.java:134)
>
> at
> org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:676)
>
> ... 101 more
> Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "Total" is
> not defined. (DataSet[CPU_Unix].__bm_afterOpen#2)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3240)
>
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3230)
>
> at
> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3303)
> at
> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1632)
>
> at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1571)
> at org.mozilla.javascript.gen.c1272._c1(DataSet[CPU_Unix].__bm_afterOpen:2)
> at org.mozilla.javascript.gen.c1272.call(DataSet[CPU_Unix].__bm_afterOpen)
> at
> org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:105)
> at org.mozilla.javascript.gen.c1273._c0(DataSet[CPU_Unix].__bm_afterOpen:1)
> at org.mozilla.javascript.gen.c1273.call(DataSet[CPU_Unix].__bm_afterOpen)
> at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
> at org.mozilla.javascript.gen.c1273.call(DataSet[CPU_Unix].__bm_afterOpen)
> at org.mozilla.javascript.gen.c1273.exec(DataSet[CPU_Unix].__bm_afterOpen)
> at
> org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:95)
>
> ... 103 more
>
>
> why the error message said "Total" is not defined??
>
> also, there is computed column which called
>
> Total.ave(row["AVG_%_Total_Processor_Time"])
>
>
> but all return null even though row["AVG_%_Total_Processor_Time"] is not
> null, is this related to the "Total" class not found?
>
>
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #685782 is a reply to message #685451] Mon, 20 June 2011 02:48 Go to previous messageGo to next message
tong123123 tong123123 is currently offline tong123123 tong123123Friend
Messages: 74
Registered: April 2011
Member
Quote:
Can you try this on a table detail row's onCreate? Row values will not
be populated in afterOpen.


I try to put the code
try{
Packages.java.lang.System.out.println("chart onRender, Total.ave(row[\"AVG_%_Total_Processor_Time\"] " + 
Total.ave(row["AVG_%_Total_Processor_Time"]));
}catch(ex){
	Packages.java.lang.System.out.println("error in chart onRender");
	Packages.java.lang.System.out.println(ex);	
}

on chart onRender event and the output is similar
Quote:

error in chart onRender
ReferenceError: "Total" is not defined.
error in chart onRender
ReferenceError: "Total" is not defined.
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #686084 is a reply to message #685782] Tue, 21 June 2011 16:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Chart script context does not have the total value. If you put it in the report say on the onCreate of the detail row you can set it as a global variable and then reference in chart script:

onCreate
reportContext.setGlobalVariable("mytotal",Total.ave(row[\"AVG_%_Total_Processor_Time\"]);

Anywhere in chart script
myglobalvar =icsc.getExternalContext().getScriptable().getGlobalVariable("mytotal");

Jason
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #686320 is a reply to message #686084] Wed, 22 June 2011 02:34 Go to previous messageGo to next message
tong123123 tong123123 is currently offline tong123123 tong123123Friend
Messages: 74
Registered: April 2011
Member
I place similar code in grid row onRender event
try{
Packages.java.lang.System.out.println("grid row onRender, Total.ave(row[\"AVG_%_Total_Processor_Time\"] " + 
Total.ave(row["AVG_%_Total_Processor_Time"]));
}catch(ex){
	Packages.java.lang.System.out.println("error in grid row onRender");
	Packages.java.lang.System.out.println(ex);	
}

and similar exception thrown
Quote:

error in grid row onRender
ReferenceError: "Total" is not defined.
error in chart onRender
ReferenceError: "Total" is not defined.


[Updated on: Wed, 22 June 2011 02:36]

Report message to a moderator

Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #686322 is a reply to message #686320] Wed, 22 June 2011 02:43 Go to previous messageGo to next message
tong123123 tong123123 is currently offline tong123123 tong123123Friend
Messages: 74
Registered: April 2011
Member
The layout structure is
grid > row > cell > chart
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #686633 is a reply to message #686322] Wed, 22 June 2011 16:20 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Try using an aggregation element and use its onCreate to store the value. Look at the attached example.

Jason
  • Attachment: total.zip
    (Size: 5.92KB, Downloaded 111 times)
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #687746 is a reply to message #686633] Thu, 23 June 2011 06:17 Go to previous messageGo to next message
tong123123 tong123123 is currently offline tong123123 tong123123Friend
Messages: 74
Registered: April 2011
Member
My birt report version is
Eclipse BIRT Designer Version 2.2.1.r221_v20070924 Build &lt;2.2.0.v20070924-1550
so cannot open your rpt. which is version
Eclipse BIRT Designer Version 2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750

in fact, is this bug in version 2.2.1?
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #687755 is a reply to message #687746] Thu, 23 June 2011 06:52 Go to previous messageGo to next message
tong123123 tong123123 is currently offline tong123123 tong123123Friend
Messages: 74
Registered: April 2011
Member
I see the help document and as the attached screen dump shown, for scripting reference, only DateTimeSpan and Finance class but no Total class, so it "Total" class not exist in birt designer 2.2.1?
Re: org.mozilla.javascript.EcmaError: ReferenceError: &quot;Total&quot; is not defined [message #687911 is a reply to message #687755] Thu, 23 June 2011 13:58 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I recreated the sample I posted in 2.2.2 (oldest version I still have) and it worked. Create a table that uses your dataset.
Add aggregation element to table footer. Enter the following in the oncreate script for the aggregation element:
reportContext.setPersistentGlobalVariable("myave",this.getValue());

Hide the table using visibility property.

Add a chart using the same dataset and enter the following chart script
function beforeGeneration( chart, icsc )
{
var mytitle = "Avg QTY for Order is: " +icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("myave");

chart.getTitle().getLabel().getCaption().setValue(mytitle);
}


Jason
Previous Topic:Script to set dates for scheduled repoorts
Next Topic:Outputting Fixed-width file using BIRT reporting tool
Goto Forum:
  


Current Time: Fri Nov 21 20:39:22 GMT 2014

Powered by FUDForum. Page generated in 0.02110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software