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)
Referencing page numbers
mogwai
<p>This topic has been raised repeatedly but I have not seen a useful solution yet and find it hard to believe that it cannot be done.</p>
<p>BIRT supports a TOC for HTML and PDF. This is a list of hyperlinks on the side.</p>
<p>What if I want to generate a printable TOC as a page at the beginning of an extensive report?</p>
<p>Is there any way I can reference page numbers of particular pages when I'm not on that page. I would need to bind a TOC page number entry to the page number of a bookmark.</p>
Find more posts tagged with
Comments
micajblock
<p>What is wrong with this sample?</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/808-simplified-printable-table-of-contents/'>http://developer.actuate.com/community/forum/index.php?/files/file/808-simplified-printable-table-of-contents/</a></p>
;
mogwai
<p>Nothing wrong with this sample
. I just hadn't found it before. </p>
<p>It works perfectly in the table but I'm battling to use this solution in my report. I can't cycle through a data set grouping. The report exists out of several independent sections with labels as section headers.</p>
<p>I need to create a grid into which I can manually insert the section labels and want to show the page number where this section starts.</p>
<p>I put</p>
<p> </p>
<p>if (vars["TOCMap"].get(this.getValue()) == null)<br>
vars["TOCMap"].put(this.getValue(), vars["TOCPage"]);</p>
<p> </p>
<p>As the onCreate script on each section header and</p>
<p> </p>
<p>this.setDisplayValue(vars["TOCMap"].get(this.getValue()));</p>
<p> </p>
<p>As the onRender script on the data elements which should display the page numbers, but I get the following error:</p>
<p> </p>
<p><b><span>org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "if (vars["TOCMap"].get(this.getValue()) == null) vars["TOCMap"].put(this.getValue(), vars["TOCPage"]);": TypeError: Cannot find function getValue in object org.eclipse.birt.report.engine.script.internal.instance.LabelInstance@e1cb34. (/report/body/label[
@id="
;322"]/method[
@name="
;onCreate"]#1)</span></b></p>
micajblock
<p>This one uses lables in section headers.</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/409-yet-another-report-with-a-printable-table-of-contents-toc/'>http://developer.actuate.com/community/forum/index.php?/files/file/409-yet-another-report-with-a-printable-table-of-contents-toc/</a></p>
;
mogwai
<p>This one also needs a data set with the headers and content in it. Is there no way to reference the page number of section headers that have been inserted manually into the report?</p>
<p>Each time there is a new section label there would have to be an onCreate script added manually to that label that pushes the section label text and page number onto a stack and in the TOC grid these values would have to be pushed onRender.</p>
<p>Your scripts should actually work but I keep on getting that error.</p>
micajblock
<p>If it is a label you need to use this.text not this.getValue()</p>
mogwai
<p>Sorry it took me so long to get back. Your solution works like a charm. I just wasn't doing it right. Thanks for the help.</p>
mogwai
<p>Having said that, it works when I run it in HTML and also if I export it from the Birt viewer into PDF or DOCX format, but when I run it directly as PDF or DOCX the page numbers are blank. Any idea why this is happening and how I could fix this?</p>
micajblock
<p>In BIRT there are 2 different ways that you can use to generate reports/documents. The first (recommended) is 2 separate tasks, one the run the report and the second to render the report. The second (not recommended) is to use one task 'runandrender'. The solution to your issue requires the 2 separate tasks (calculate the page numbers in the run task, display then in the render task). In the designer as you can have seen when you render directly to PDF or DOCX it uses the runandrender task.</p>
<p> </p>
<p>When you embed BIRT in your application make sure you use the 2 separate tasks.</p>
<p> </p>
<p>I hope this clears things up for you.</p>
mogwai
<p>It does indeed. Thank you.</p>
micajblock
<p>You're welcome.</p>