This new version was designed by Puck Puck. This is an updated version of the example here:<br />
<br />
http://developer.actuate.com/community/devshare/_/designing-birt-reports/1080-another-report-with-printable-table-of-contents-toc<br />
<br />
This one is much simplified and uses Report variables instead of script variables.<br />
<br />
In the end, 3 lines of code, and no more needing to increment the page counter in the tables. The page counter increment is done using the onPageStart event of the report itself, which means you can have as many report items as you want and not need to add code to any of them.<br />
<br />
Note for OS BIRT: The example uses a technique where at generation time it gets the page numbers and then displays them at render time. In order for this to work the run and render tasks need to be separate. In OS BIRT the preview and run servlet use the runandrender task not two separate tasks, hence my example will not work. IN OS BIRT Designer all view options use the runandrender task. In order for this to work in OS BIRT Designer open the report in a viewer and then export it to another format.