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)
Page N of M - With Grouping
dbmathis
Hi All,
I am using version 3.7.2 and printing to PDF. I have a list with four rows which is grouped by name (person's name). I am using the Auto Text variables Page and Total Page Count in the Master Page to get the Page N of M on the bottom of every page.
The problem is that there are 4 groups and 11 total pages. The numbering is rendering like: Page 1 of 11, Page 2 of 11 etc.. Instead of by group like: Page 1 of 4, Page 2 of 4 for group one and then Page 1 of 3, Page 2 of 3 for group two and so on for example. How do I get the numbering at the bottom of each page to be for the group and not the entire number of pages?
Thanks. David
Find more posts tagged with
Comments
kclark
<a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1404-group-page-numbering/'>Here's
a good devshare</a> that has an example showing what your trying to do. Have a look and let me know if it helps
dbmathis
Thanks kclark,
I tried this with 3.7.2 outputting to 3.7.2 earlier and the first variable Page, doesn't reset for each group and the total page count variable is NaN for every page. I usually exhaust Google and Dev Shares before coming here.
. Have you tried this in 3.7.2 outputting to PDF?
kclark
If you go to webviewer -> export to PDF it'll show correctly but it won't if you render the PDF straight out of eclipse. When you deploy you're report it should show as needed since it will be in separate run and render tasks.
dbmathis
Thanks. The dev share is implemented into a table. My root element is a list. I am getting several errors trying to implement this to my list. Any ideas how I should modify this approach to work with a list?
dbmathis
I am getting this error.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>The following items have errors:
TextData (id = 6051):
+ There are errors evaluating script "currentGroup = parseInt(reportContext.getPersistentGlobalVariable("pg" + pageNumber.toString()));
groupEndPageTotal = parseInt(reportContext.getPersistentGlobalVariable(currentGroup.toString()));
lastGroup = currentGroup - 1;
temp = reportContext.getPersistentGlobalVariable(lastGroup.toString());
if (temp == null){
temp = 0;
}
else{
parseInt(temp);
}
currentGroupPage = pageNumber - temp;
groupTotalPage = groupEndPageTotal - temp;
this.text = "page " + currentGroupPage.toString() + " of " + groupTotalPage.toString();":
error instantiating (): class java.lang.Number is interface or abstract (/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"]#1) (Element ID:6051)
birt.core.JavascriptCommonError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "currentGroup = parseInt(reportContext.getPersistentGlobalVariable("pg" + pageNumber.toString()));
groupEndPageTotal = parseInt(reportContext.getPersistentGlobalVariable(currentGroup.toString()));
lastGroup = currentGroup - 1;
temp = reportContext.getPersistentGlobalVariable(lastGroup.toString());
if (temp == null){
temp = 0;
}
else{
parseInt(temp);
}
currentGroupPage = pageNumber - temp;
groupTotalPage = groupEndPageTotal - temp;
this.text = "page " + currentGroupPage.toString() + " of " + groupTotalPage.toString();":
error instantiating (): class java.lang.Number is interface or abstract (/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"]#1) (Element ID:6051)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:244)
at org.eclipse.birt.report.engine.script.internal.DynamicTextScriptExecutor.handleOnRender(DynamicTextScriptExecutor.java:96)
at org.eclipse.birt.report.engine.script.internal.OnRenderScriptVisitor.visitDynamicTextItem(OnRenderScriptVisitor.java:161)
at org.eclipse.birt.report.engine.ir.DynamicTextItemDesign.accept(DynamicTextItemDesign.java:65)
at org.eclipse.birt.report.engine.script.internal.OnRenderScriptVisitor.onRender(OnRenderScriptVisitor.java:73)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.handleOnRender(LocalizedContentVisitor.java:1228)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localizeForeign(LocalizedContentVisitor.java:566)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:163)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:37)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:87)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:92)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeMasterPage(ReportExecutorUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.start(HTMLPageLM.java:147)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:91)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:661)
at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:294)
at org.eclipse.birt.report.service.ReportEngineService.renderReport(ReportEngineService.java:1547)
at org.eclipse.birt.report.service.BirtViewerReportService.getPage(BirtViewerReportService.java:204)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.doExecution(AbstractGetPageActionHandler.java:238)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.__execute(AbstractGetPageActionHandler.java:105)
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.handleGetPage(BirtDocumentProcessor.java:87)
at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.GeneratedMethodAccessor227.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:727)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.eclipse.birt.core.exception.CoreException: There are errors evaluating script "currentGroup = parseInt(reportContext.getPersistentGlobalVariable("pg" + pageNumber.toString()));
groupEndPageTotal = parseInt(reportContext.getPersistentGlobalVariable(currentGroup.toString()));
lastGroup = currentGroup - 1;
temp = reportContext.getPersistentGlobalVariable(lastGroup.toString());
if (temp == null){
temp = 0;
}
else{
parseInt(temp);
}
currentGroupPage = pageNumber - temp;
groupTotalPage = groupEndPageTotal - temp;
this.text = "page " + currentGroupPage.toString() + " of " + groupTotalPage.toString();":
error instantiating (): class java.lang.Number is interface or abstract (/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"]#1)
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:295)
at org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:154)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:781)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:710)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScriptInternal(ScriptExecutor.java:117)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScript(ScriptExecutor.java:104)
at org.eclipse.birt.report.engine.script.internal.DynamicTextScriptExecutor.handleOnRender(DynamicTextScriptExecutor.java:86)
... 70 more
Caused by: org.mozilla.javascript.EvaluatorException: error instantiating (): class java.lang.Number is interface or abstract (/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"]#1)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:964)
at org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:220)
at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:1000)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:958)
at org.mozilla.javascript.ScriptRuntime.toObjectOrNull(ScriptRuntime.java:918)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2213)
at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:117)
at org.mozilla.javascript.gen.c16616._c0(/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"]:1)
at org.mozilla.javascript.gen.c16616.call(/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"])
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c16616.call(/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"])
at org.mozilla.javascript.gen.c16616.exec(/report/page-setup/simple-master-page[
@id="
;2"]/page-footer/grid[
@id="
;5954"]/row[
@id="
;5957"]/cell[
@id="
;5959"]/grid[
@id="
;405"]/row[
@id="
;409"]/cell[
@id="
;414"]/text-data[
@id="
;6051"]/method[
@name="
;onRender"])
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:290)
... 76 more
</pre>
dbmathis
I have still not been able to figure this out within a list, rather than a table, as seen in the dev share provided above.<br />
<br />
Here's another error I am getting when trying to put the page number into the global variable. The difference is that I am not putting the code into the onCreate of a table row. I have a list grouped by persons name and within each list I have grids, tables, text elements etc. I was added the code to the onCreate of these elements. <br />
<br />
kclark, anyone know how I would get Page N of M per group in a list? I will keep trying, hopefully someone has done this before.<br />
<br />
Also, I added some debug code to the group script and PGVcounter is not getting incremented. I just added a label to the group by name footer and added the following code to the onCreate.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.setPersistentGlobalVariable(PGVcounter.toString(),pageNumber.toString());
PGVcounter++;
</pre>
Here's the error:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "reportContext.setPersistentGlobalVariable("pg" + pageNumber.toString(),PGVcounter.toString());":
error instantiating (): class java.lang.Number is interface or abstract (/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"]#1) (Element ID:5868)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:244)
at org.eclipse.birt.report.engine.script.internal.TableScriptExecutor.handleOnCreate(TableScriptExecutor.java:64)
at org.eclipse.birt.report.engine.script.internal.OnCreateScriptVisitor.visitTableItem(OnCreateScriptVisitor.java:185)
at org.eclipse.birt.report.engine.ir.TableItemDesign.accept(TableItemDesign.java:53)
at org.eclipse.birt.report.engine.script.internal.OnCreateScriptVisitor.onCreate(OnCreateScriptVisitor.java:73)
at org.eclipse.birt.report.engine.executor.ReportItemExecutor.handleOnCreate(ReportItemExecutor.java:911)
at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:87)
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.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:48)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLGroupLM.layoutChildren(HTMLGroupLM.java:117)
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:48)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLListLM.layoutChildren(HTMLListLM.java:72)
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:48)
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.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:929)
at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:120)
at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.eclipse.birt.core.exception.CoreException: There are errors evaluating script "reportContext.setPersistentGlobalVariable("pg" + pageNumber.toString(),PGVcounter.toString());":
error instantiating (): class java.lang.Number is interface or abstract (/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"]#1)
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:295)
at org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:154)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:781)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:710)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScriptInternal(ScriptExecutor.java:117)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScript(ScriptExecutor.java:104)
at org.eclipse.birt.report.engine.script.internal.TableScriptExecutor.handleOnCreate(TableScriptExecutor.java:56)
... 55 more
Caused by: org.mozilla.javascript.EvaluatorException: error instantiating (): class java.lang.Number is interface or abstract (/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"]#1)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:964)
at org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:220)
at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:1000)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:958)
at org.mozilla.javascript.ScriptRuntime.toObjectOrNull(ScriptRuntime.java:918)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2213)
at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:117)
at org.mozilla.javascript.gen.c1929._c0(/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"]:1)
at org.mozilla.javascript.gen.c1929.call(/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"])
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c1929.call(/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"])
at org.mozilla.javascript.gen.c1929.exec(/report/body/list[
@id="
;11"]/detail/grid[
@id="
;32"]/method[
@name="
;onCreate"])
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:290)
... 61 more
</pre>
kclark
I've attached an example that should work for you. I created a computed column called totalGrp. I use it to count how many groups I'm going to have using count unique. I created a counter in the initialize() of the report. var groupNum = 0; Then created a page variable called groupNum with a default value of 0. In the onCreate() of my group header I used groupNum++; then assign the value to the page variable in onPageEnd() of the master page. Then I was able to use a variable autotext object in the footer to display group n of m. Let me know if this works for you.
dbmathis
Thanks, I will take a look. I noticed with the dev share that part of the problem seems to be that in a list, I don't seem to have access to the PGVcounter variable. I moved it to a global variable and eliminated that error, but now I get an error with the group script.
. I am trying hard not to feel like I am in a BIRT war.
kclark
What error are you getting? I had an error after saving it because my computed column dropped the aggregation, you might check that the computed column has count unique set.
dbmathis
Oh, I was talking about my attempt to modify the dev share. I am just now looking ta you most recent design file.
I am seeing:
1 / 7
1 / 7
1 / 7
2 / 7
3 / 7
4 / 7
5 / 7
6 / 7
7 / 7
7 / 7
What I am looking for, if this is 3 in the group is:
1 / 3
2 / 3
3 / 3
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
1 / 2
2 / 2
I am looking at your code trying to figure it out, but any advice is very appreciated.
dbmathis
So I got the dev share working if I view it in the web viewer. When I uploaded the report to the production environment I get...
1 of NaN
2 of NaN
3 of NaN
4 of NaN
5 of NaN
6 of NaN
and counting all the way to the end, not considering the grouping.
I guess the dev share approach does not work with PDF?
I was something about having to run the run and render tasks separately, however I am not sure where that is done. Is that done in eclipse? Or is this something done on the server? This is a production controlled server that I don't have access to.
---
To reiterate my issue:
I am using version 3.7.2 and printing to PDF. I have a list with four rows which is grouped by name (person's name). I am using the Auto Text variables Page and Total Page Count in the Master Page to get the Page N of M on the bottom of every page.
The problem is that there are 4 groups and 11 total pages. The numbering is rendering like: Page 1 of 11, Page 2 of 11 etc.. Instead of by group like: Page 1 of 4, Page 2 of 4 for group one and then Page 1 of 3, Page 2 of 3 for group two and so on for example. How do I get the numbering at the bottom of each page to be for the group and not the entire number of pages?
kclark, per the response above, I could not get your approach to work, and I noticed that the computed field is in a single data set. I have about 12 data sets in this report. Seems like that might break you code if I implement it into mine. Not sure.
kclark
I've attached another example and tested it with PDF and the Webviewer. It lists n of m for each group
1 of 3
2 of 3
3 of 3
1 of 4
2 of 4
3 of 4
etc...
This example should work for you. I modified the devshare to make it work with a list. Let me know if this one does the trick
dbmathis
Thanks kclark, I really appreciate the help but this is not working of me in PDF. I get 1 of NAN for every page in group 1 and then 2 of Nan for every page in group 2 and so on.
I spoke to the Report Engine administrators and we use RunAndRenderTask and it can't be changed. I am starting to think that I may not be able to accomplish this, but don't really want to accept that.
I think the goal here should be to get it working when run in eclipse for PDF. This is exactly the setup that's in our production environment it seems.
FYI - I have the most recent design you attached working in web viewer perfectly. Only I have so many different elements in the list I had to place the onCreate scripts on every element to ensure I was getting all of the pages.
kclark
The only way I think you could get around this is if you set a fixed height to the list page break. Then you could calculate how many pages per group you would have. I would do this with a computed column but reading over your post I don't know if this would work for you?
dbmathis
Thanks kclark, I guess the good news is, people who are searching for this type of thing on Google will find this thread of great information.
.
It seems like page numbering by groups would be a common request. I wonder if there are plans to add this type of functionality OTB.