Table of Contents
-
Wednesday, June 25, 2008 6:50 AM
Hi All,
I have a table of contents where i need to show different sections of a report with the page numbers.. However, before the section starts, there is a free text area which can take 1-3 pages (not fixed). Is there any way to dynamically determine the page numbers for the sections.. may be by using something like a bookmark.. but am not quite sure if something like this exists.
Cheers.
All Replies
-
Thursday, June 26, 2008 9:53 AM
Hi,
You can rest the page number on group breaks.
Resetting the page number on group breaks isn't natively supported, but it can be achieved by tracking group breaks in a shared variable and subtracting off the page offset of the first page of the group from the current page number.
Step 1: Make sure there's a textbox in the report which contains the group expression
Step 2: Add shared variables to track the current group and page offset
Shared offset as Integer
Shared currentgroup as ObjectStep 3: Add a custom function to set the shared variables and retrieve the group page number
Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
If Not (group = currentgroup)
offset = pagenumber - 1
currentgroup = group
End If
Return pagenumber - offset
End FunctionStep 4: Use the function in the page header or footer
=Code.GetGroupPageNumber(ReportItems!Category.Value,Globals!PageNumber)Note: Because this uses static variables, if two people run the report at the exact same moment, there's a slim chance one will smash the other's variable state (In SQL 2000, this could occasionally happen due to two users paginating through the same report at the same time, not just due to exactly simultaneous executions) If you need to be 100% certain to avoid this, you can make each of the shared variables a hash table based on user ID (Globals!UserID).
-
Monday, June 21, 2010 9:13 PMCan you give an example of how to make the shared variables a hash table based on user ID ?

