Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
External JS Function Not Working In BIRT Chart
lendjones
<p>I have an external JS file I'm using to calculate the working days between two dates. I've added it into my report's resources area and I can use it in a grid to calculate the working days. </p>
<p> </p>
<p>The problem is I have a dial chart that is not picking up the function. When I try to use a binding element that references my function "getWorkingDays"</p>
<p> </p>
<p>I receive this error in the edit chart window: <strong>ReferenceError: "getWorkingDays" is not defined. </strong></p>
<p> </p>
<p>Is there a way for me to get my chart to see my JS function, so I can use the result of a calculation as the Meter Value Definiton? </p>
Find more posts tagged with
Comments
JFreeman
<p>What version of BIRT are you using?<br>
What type of chart are you creating (HTML5, SVG, PNG, etc.)?</p>
<p>Where exactly are you adding the scripting when you get the reference error?</p>
<p> </p>
<p>My guess without more information, is that where you have the scripting in place on the chart is during the client side rendering versus server side generation.</p>
lendjones
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="137444" data-time="1435333852">
<div>
<p>What version of BIRT are you using?<br>
What type of chart are you creating (HTML5, SVG, PNG, etc.)?</p>
<p>Where exactly are you adding the scripting when you get the reference error?</p>
<p> </p>
<p>My guess without more information, is that where you have the scripting in place on the chart is during the client side rendering versus server side generation.</p>
</div>
</blockquote>
<p> </p>
<p>I'm using BIRT 4.3. </p>
<p>I'm creating a Dial Chart in the SVG format.</p>
<p>I'm referencing the script in the column binding for the Chart itself. I've tried placing the script directly in the column binding and get a scripting error. </p>
<p> </p>
<p>For example, </p>
<p> </p>
<p>My script is called getBusinessDaysFunction(startDate, endDate) [I changed the name from my OP] </p>
<p> </p>
<p>I created a column binding named "AGE_OF_OLDEST_PENDING_CHECK." Within that binding I have the following expression:</p>
<pre class="_prettyXprint">
getBusinessDaysFunction(row["OLDEST_PENDING_CHECK_DATE"],new Date())</pre>
<p>The OLDEST_PENDING_CHECK_DATE column binding aggregation has the following expression: </p>
<pre class="_prettyXprint">
dataSetRow["DATE_RECEIVED"]</pre>
<p>which I receive from a query. The aggregation uses the MIN function to return the earliest date. </p>
<p> </p>
<p>I'm trying to use the row["AGE_OF_OLDEST_PENDING_CHECK"] as the Meter Value Definition, but I receive the error: ReferenceError: "getBusinessDaysFunction" is not defined. </p>
JFreeman
<p>Even though you are seeing this error in the chart editor window, have you completed building the chart and attempted running it?</p>
<p> </p>
<p>I just tested this in my environment and I can replicate the not defined error in the chart builder for my external js files function. However, if I build the chart and run the report it, not errors occur and the js function is executed properly.</p>
lendjones
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="137452" data-time="1435340331">
<div>
<p>Even though you are seeing this error in the chart editor window, have you completed building the chart and attempted running it?</p>
<p> </p>
<p>I just tested this in my environment and I can replicate the not defined error in the chart builder for my external js files function. However, if I build the chart and run the report it, not errors occur and the js function is executed properly.</p>
</div>
</blockquote>
<p>The chart was not showing up for me. I deleted the chart and rebuilt it and while I did still see the error, it executed properly. I just have to add the styling back. </p>
<p> </p>
<p>Should I be worried about the ReferenceError? Or is it just a bug? </p>
<p> </p>
<p>Thank you for your help with this. I appreciate it. </p>
lendjones
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="137452" data-time="1435340331">
<div>
<p>Even though you are seeing this error in the chart editor window, have you completed building the chart and attempted running it?</p>
<p> </p>
<p>I just tested this in my environment and I can replicate the not defined error in the chart builder for my external js files function. However, if I build the chart and run the report it, not errors occur and the js function is executed properly.</p>
</div>
</blockquote>
<p>So, the Chart works in Preview, but when I try to deploy it using the BIRT Server Application the entire report errors out and I receive the following errors: </p>
<pre class="_prettyXprint">
org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information.
ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1245)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1224)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
at org.eclipse.birt.report.engine.executor.GridItemExecutor.execute(GridItemExecutor.java:65)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46)
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.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:249)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:269)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:86)
at org.eclipse.birt.report.service.ReportEngineService.runReport(ReportEngineService.java:1325)
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.BirtChangeParameterActionHandler.runReport(BirtChangeParameterActionHandler.java:58)
at org.eclipse.birt.report.service.actionhandler.AbstractChangeParameterActionHandler.__execute(AbstractChangeParameterActionHandler.java:52)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleChangeParameter(BirtDocumentProcessor.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
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:454)
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(BirtSoapMessageDispatcherServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1690)
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred. See next exception for more information.
ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123)
at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:54)
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateCompiledExpression(ExprEvaluateUtil.java:219)
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateCompiledExpression(ExprEvaluateUtil.java:233)
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateExpression(ExprEvaluateUtil.java:78)
at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.evaluateValue(BindingColumnsEvalUtil.java:201)
at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.getColumnsValue(BindingColumnsEvalUtil.java:161)
at org.eclipse.birt.data.engine.impl.ResultIterator.prepareCurrentRow(ResultIterator.java:784)
at org.eclipse.birt.data.engine.impl.ResultIterator.(ResultIterator.java:168)
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:215)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.(QueryResultSet.java:98)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168)
at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:83)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:275)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
... 83 more
Caused by: org.eclipse.birt.core.exception.CoreException: ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:307)
at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:55)
... 97 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "getBusinessDaysFunction" is not defined.
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)
at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3134)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:49)
... 97 more
org.eclipse.birt.report.engine.api.EngineException: Not able to evaluate sort, grouping, filter or binding expression. A data field that is used in the expression does not exist in the dataset.
A BIRT exception occurred. See next exception for more information.
There are errors evaluating script "getBusinessDaysFunction(row["DEPOSIT_TICKET_DATE_CREATED"],new Date())":
ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1245)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1224)
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.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46)
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:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:249)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:269)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:86)
at org.eclipse.birt.report.service.ReportEngineService.runReport(ReportEngineService.java:1325)
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.BirtChangeParameterActionHandler.runReport(BirtChangeParameterActionHandler.java:58)
at org.eclipse.birt.report.service.actionhandler.AbstractChangeParameterActionHandler.__execute(AbstractChangeParameterActionHandler.java:52)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleChangeParameter(BirtDocumentProcessor.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
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:454)
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(BirtSoapMessageDispatcherServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1690)
Caused by: org.eclipse.birt.data.engine.core.DataException: Not able to evaluate sort, grouping, filter or binding expression. A data field that is used in the expression does not exist in the dataset.
A BIRT exception occurred. See next exception for more information.
There are errors evaluating script "getBusinessDaysFunction(row["DEPOSIT_TICKET_DATE_CREATED"],new Date())":
ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.data.engine.impl.ComputedColumnHelper$ComputedColumnHelperInstance.process(ComputedColumnHelper.java:524)
at org.eclipse.birt.data.engine.impl.ComputedColumnHelper.process(ComputedColumnHelper.java:138)
at org.eclipse.birt.data.engine.executor.cache.RowResultSet.processFetchEvent(RowResultSet.java:173)
at org.eclipse.birt.data.engine.executor.cache.RowResultSet.doNext(RowResultSet.java:126)
at org.eclipse.birt.data.engine.executor.cache.RowResultSet.next(RowResultSet.java:96)
at org.eclipse.birt.data.engine.executor.cache.ExpandableRowResultSet.next(ExpandableRowResultSet.java:63)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.populateData(SmartCacheHelper.java:318)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initInstance(SmartCacheHelper.java:285)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.getResultSetCache(SmartCacheHelper.java:246)
at org.eclipse.birt.data.engine.executor.cache.SmartCache.(SmartCache.java:74)
at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.populateOdiResultSet(PassUtil.java:153)
at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.pass(PassUtil.java:62)
at org.eclipse.birt.data.engine.executor.transform.pass.FilterCalculator.makeFirstPassToMultiPassFilter(FilterCalculator.java:223)
at org.eclipse.birt.data.engine.executor.transform.pass.FilterCalculator.makeMultiPassToFilter(FilterCalculator.java:149)
at org.eclipse.birt.data.engine.executor.transform.pass.FilterCalculator.doFiltering(FilterCalculator.java:111)
at org.eclipse.birt.data.engine.executor.transform.pass.FilterCalculator.applyFilters(FilterCalculator.java:89)
at org.eclipse.birt.data.engine.executor.transform.pass.FilterCalculator.applyFilters(FilterCalculator.java:63)
at org.eclipse.birt.data.engine.executor.transform.pass.RowProcessUtil.applyFilters(RowProcessUtil.java:177)
at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.doRowFiltering(ResultSetProcessUtil.java:597)
at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.populateResultSet(ResultSetProcessUtil.java:142)
at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.doPopulate(ResultSetProcessUtil.java:95)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.prepareQueryResultSet(PassManager.java:108)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass(PassManager.java:135)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateResultSet(PassManager.java:74)
at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateResultSet(ResultSetPopulator.java:218)
at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.(CachedResultSet.java:101)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.execute(DataSourceQuery.java:1061)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:503)
at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:1208)
at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:233)
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:178)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.(QueryResultSet.java:98)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168)
at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:83)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:275)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
... 72 more
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred. See next exception for more information.
There are errors evaluating script "getBusinessDaysFunction(row["DEPOSIT_TICKET_DATE_CREATED"],new Date())":
ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123)
at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evalExpr(ScriptEvalUtil.java:947)
at org.eclipse.birt.data.engine.impl.ComputedColumnHelper$ComputedColumnHelperInstance.process(ComputedColumnHelper.java:494)
... 108 more
Caused by: org.eclipse.birt.core.exception.CoreException: There are errors evaluating script "getBusinessDaysFunction(row["DEPOSIT_TICKET_DATE_CREATED"],new Date())":
ReferenceError: "getBusinessDaysFunction" is not defined.
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:295)
at org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:159)
at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evalExpr(ScriptEvalUtil.java:919)
... 109 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "getBusinessDaysFunction" is not defined.
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1758)
at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2135)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
at org.mozilla.javascript.gen.c310._c0(unnamed script)
at org.mozilla.javascript.gen.c310.call(unnamed script)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c310.call(unnamed script)
at org.mozilla.javascript.gen.c310.exec(unnamed script)
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:290)
... 111 more</pre>
<p>It seems as if the report cannot find my external JS function, but I've double-checked that the external JS file is included in the Resources of the report under "Properties->Resources->Javascript Files". </p>
JFreeman
<p>Did you verify the external java script file was also published into your servers resources directory?</p>
lendjones
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="137478" data-time="1435590594">
<div>
<p>Did you verify the external java script file was also published into your servers resources directory?</p>
</div>
</blockquote>
<p>No, I didn't know it was also supposed to be placed in the Resources directory on the server. Do I just upload the same JS file to the Resources folder with the same name? </p>
JFreeman
<p>Yeah, the JS file needs to be uploaded with the same name you are referencing within the report design.</p>
<p> </p>
<p>Any external resources specified within the report design are external to the report. A pointer is stored within the report design with a relative path to the specified resource within the resources directory.</p>
lendjones
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="137483" data-time="1435592987">
<div>
<p>Yeah, the JS file needs to be uploaded with the same name you are referencing within the report design.</p>
<p> </p>
<p>Any external resources specified within the report design are external to the report. A pointer is stored within the report design with a relative path to the specified resource within the resources directory.</p>
</div>
</blockquote>
<p>Where exactly is this JS file supposed to go on the server? I've created a folder named "resources" (there's also the following folders: documents, logs, META-INF, report, scriptlib, webcontent, and WEB-INF). </p>
JFreeman
<p>The directory structure should match what you have created within the project in your designer.</p>
<p>For example, if you store your js files in a folder structure of /resources/script/ within the project in your designer, you would need to create a folder named resources with a sub directory of script and place the js file there.</p>
<p> </p>
<p>If you are storing the js file in the root of your project in the designer, then it would need to go in the root of the web viewer.</p>
<p> </p>
<p>A good practice is to have a single resources directory with sub directories for the various resources such as report libraries, CSS files, javascript files, etc.</p>
lendjones
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="137499" data-time="1435610719">
<div>
<p>The directory structure should match what you have created within the project in your designer.</p>
<p>For example, if you store your js files in a folder structure of /resources/script/ within the project in your designer, you would need to create a folder named resources with a sub directory of script and place the js file there.</p>
<p> </p>
<p>If you are storing the js file in the root of your project in the designer, then it would need to go in the root of the web viewer.</p>
<p> </p>
<p>A good practice is to have a single resources directory with sub directories for the various resources such as report libraries, CSS files, javascript files, etc.</p>
</div>
</blockquote>
<p>Thanks so much for the help with this. I set up the directory on the server to match up with how my directory is set up on my workstation and the report I created in BIRT 4.3 is now working! </p>
<p> </p>
<p>
</p>
<p> </p>
<p>I have a new problem regarding using an external JS file. I'm not sure if I should create a new topic or not. </p>
<p> </p>
<p>I updated to BIRT 4.5 and reinstalled Eclipse and now am having issues using the external JS file locally on my PC. My external JS file is called </p>
<pre class="_prettyXprint">
getBusinessDayFunctionCustomDaysRemoved</pre>
<p>. I've added it to the Resources of the report and it shows up in Resource Explorer. </p>
<p> </p>
<p>I have a grid and I'm using an Aggregation called "<strong>FiveDayCount</strong>". It's purpose is to count and filter the data pulled from a data set name "<strong>CaseInfoUser</strong>", which contains the following columns: "<strong>User</strong>", "<strong>DateAssigned</strong>", "<strong>DateCompleted</strong>", "<strong>ID</strong>". The Data Type is Integer and the function I'm using is COUNT. The expression I'm using is: <strong>row["ID"]</strong> and the Filter Condition I'm using is: </p>
<pre class="_prettyXprint">
getBusinessDaysFunctionCustomDaysRemoved(row["DateAssigned"],row["DateCompleted"]) < 5 </pre>
<p>I recieve the following error when I run the report: </p>
<pre class="_prettyXprint">
+ A BIRT exception occurred. See next exception for more information.
ReferenceError: "getBusinessDaysFunctionCustomDaysRemoved" is not defined. </pre>
<p>It's as if it can't see the function. This is all locally on my PC. I don't know if this is a problem with my reinstalled Eclipse or if I'm missing something. My previous reports created in 4.3 seem to still work. You've been so helpful with my previous issues, I hope you can illuminate whatever is causing this one. </p>
JFreeman
<p>That is a bit strange.</p>
<p>I just tested in 4.5.0 and I can call an external JS file without issue.</p>
<p> </p>
<p>I've attached a simple sample report that calls an external JS function that just returns 1.</p>
<p>Can you test this sample in your environment and let me know if it works?</p>