Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Create a table of contents dynamically

Status
Not open for further replies.

bigz60

Technical User
Apr 18, 2007
40
0
0
US
Hello.
I have a created a budget report using CR 9 and this budget includes almost 100 different funds.

My report is grouped by the different funds.

I would like to create a table of contents that simply state the fund name and the page number that it starts on.

I have tried creating different arrays and sharing them with a subreport, but I cannot seem to figure it out.

I was wondering if there were an easy way to do this.

If there is no easy way, here is what I have tried so far:

Code:
In the Main Report Group Header:

whileprintingrecords;
stringvar array GroupNameArray;
numbervar groupcounter;

if not({@Fund_Names} in GroupNameArray) then
groupcounter:= groupcounter + 1;

if groupcounter <= 1000

then (redim preserve groupnamearray[groupcounter];

GroupNameArray[groupcounter] := {@Fund_Names})

In the subreport I have place the following in the details section:
Code:
whileprintingrecords;

stringvar array GroupNameArray;
Redim preserve GroupNameArray[Ubound(groupnamearray) +1];
GroupNameArray[ubound(GroupNameArray)] := {@Fund_names}

This appears to be working just fine. The problem I am having is passing the pagenumber from the Main report to the subreport.

I tried the same procedure as above for the pagenumber, but the result is only the pagenumber of the subreport, not the pagenumber of the main report.

I hope all of this makes sense.
 
For one thing, you need to make the variables shared, as in:

whileprintingrecords;
shared stringvar array GroupNameArray;
shared numbervar groupcounter; //etc.

-LB
 
If the final destination is a pdf export, an alternative is to use one of the 3rd-party tools listed at:
My Visual CUT software allows you to add bookmarks and a Table of Contents to pdf exports from Crystal. Here's an example of what the result looks like:
- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top