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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table of Contents

Status
Not open for further replies.

longfellow

IS-IT--Management
Mar 28, 2002
75
IN
dear all

I have a page called Table Of Contents(TOC) which conatins all the various details of the pages in the reports .How do i generate the Page numbers randomly In this TOC at runtime. B'cas the no of pages depends on the data based in my database . Are there any formulas for doing the same.Its very urgent. Please reply immediately

Thanking you in advance

longfellow
 
I have never done this, but you "should" be able to use shared variables to track the first page number of a group, then insert this as a subreport in the report header as your TOC.

Let me know if you pull this off. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
This is not very easy, and in many cases can't be done. The only way to know the page numbers is to first generate the actual pages. That means that any subreports you use to find page numbers are going to have to run that many pages. The only technique I can think of is to create an array, then while the report is running capture the topics and pages and store them in an array, and then print this array at the end of the report. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Where do i try this array . People at my work place are very adamant regd this TOC. When i told them its very difficult and not possible, my boss told i was not trying to solve the problem rather trying to escape from it. Please help me. Now this alone is left in my whole report.
Where and how do i try this .Please help me

Thanking you
Longfellow
 
As Ken said .... it is not easy, but I have done it myself once or twice...but only when I had to.

The degree of difficulty increases with the ammount of information that you wish to display in this table, since that will govern how many formulas you will require.

You have not described your TOC so I will give you an example and the thought processes involved:

Creation and filling of arrays is the way to go as Ken pointed out...but then I sort of like the idea of a subreport that Dgillz has proposed...Perhaps we can combine the 2 ideas into one (wish I had thought of this a long time ago.)...in the past I have been using formulas to display the final data...perhaps an unlinked subreport could do it much easier.

Proposed method
===============

The creation of shared variable arrays to capture the main heading and page number where it first occurs. Then passing this information to an unlinked subreport that will simply cycle through those group headings and print the page numbers associated with them.

Formulas

@Initialization (supressed in report header)

WhilePrintingrecords;
//size of arrays 50% more than what you expect (max 1000)
Shared StringVar Array majorHeading := ["","",....,""]; Shared StringVar Array MH_Pagenumber := ["","",....,""];
numberVar MH_counter := 0;

@RecordPagenumber (suppress in the Group header of the
page that you wish to number)
WhilePrintingrecords;
Shared StringVar Array majorHeading ;
Shared StringVar Array MH_Pagenumber;
numberVar MH_counter ;

if not InRepeatedGroupHeader then
(
MH_counter := MH_counter + 1;
majorHeading [MH_counter] := {Table.MajorGroup};
MH_Pagenumber [MH_counter] := totext(pagenumber,0);

Now create a subreport with no linking to the main report. The the subreport would be structured to repeat just the major headings and descriptions associated with them

Major heading Description (optional) Page Number

{Table.MajorGroup} {Table.Description} {@FindPageNum}


{@FindPageNum}

WhilePrintingRecords;
Shared StringVar Array majorHeading ;
Shared StringVar Array MH_Pagenumber;
NumberVar iCount;
StringVar result := "";

for icount := 1 to ubound(majorHeading) do
(
if majorHeading[icount] = {Table.MajorGroup} then
(
result := MH_Pagenumber[iCount];
exit for;
);
);

Result;

Actually this seems almost too simple and is easy to impliment....I wish I had thought of this unlinked subreport (placed in the report footer) before.

You can expand on this idea to get subheadings as well.

Hope this helps









Jim
JimBroadbent@Hotmail.com
 
I did not understand where to put the second formula that is recordpage number. You asked me to put it in group header of the page .Except for my Title page of the report which has a page header . all the other pages are in seperate sections. As such i don't have any group header or foter in my individual sections.
Where should the FINDPAGENUM formula be put in which section.
Is there any where else i can place these formulas. Also if i have 3 or 4 subreports in each section how do i decide where i should put these formulas.
Please reply immdly

Tanking you

Longfellow
 
I assumed that you have a standard report type with groups and detail lines

How is your report layed out??

What I meant was for the formula , @RecordPagenumber, to be placed suppressed in the group header where you wish your user to see a page number

for example:

if I had a group called Products...I would put this formula in that header (suppressed). JimBroadbent@Hotmail.com

Reward good advice with a star, it reinforces us and helps others find answers to their problems.
 
My TOC contents are like the Following

PageNo
List of Tables i
List Of Figures ii
List Of Appendices iii

1) Introduction 1
2) Design 1
3) Considerations 1
4) Students 1
5) Procedures 2
6) Collections 2
7) Signs 3
8) Deviations 3
9) Complaints 3-4

Now how do i make this into a formula based TOC can you help me

Thanking You

Longfellow

 
I asked for the layout of the crystal report....not the printout...How is your report constructed??? Describe the groups, subreports used...how they are placed.....You have given us virtually no information.

My previous post should work on a standard report (wish I had thought of it months ago when I had this problem as well)...but you indicate you cannot use it.....well...give us something to work with by describing your report in detail for us.. JimBroadbent@Hotmail.com
 
AS SUCH I DONT UNDERSTAND WHAT GROUPS ARE NOR SO I HAVE ANY GROUPS IN THE REPORT. FOR THE TOPICS MENTIONED IN THE ABOVE PRINTOUT I HAVE EITHER ONE OR MORE SUB_REPORTS FOR EACH TOPIC.AS DATA IS FETCHED FROM DIFFERENT TABLES FOR THESE SUB REPORTS. MY WHOLE REPORT IS DIVIDED IN THE FORM OF SECTIONS.

My understanding is that whatever contains in a section should be considered as the group header. I dont know what i assume is correct or wrong

the first section contains the title of the report
1 subreport is there in this section

the second section conatins a breif synopsis
10 subreports are there in thsi section

the third section will contain the TOC
As of now there is no subreport in this section it is filled with static text

the fouth section starts the introduction part and continues with a small section on the design part
There are 4 subreports in these 2 sections.

then the fifth section continues with objectives
there are 11 subreports in this section

in the next section i have the collection details
2 subreports are there in these . The second subreport in this section can grow upto 10 pages at a time

in the next section i have the record deviations
2 subreports are there in this section .

i have 3 samll sections after thsi containing
one subreport each . If there is data these sections can grow upto 5 pages.

this is followed by 3 more sections with 3 more subreports

Have i provided the info you are lookin for or anything else is required please let me know. I will give more details

Thanking you

Longfellow
 
Since this report always has he same 12 sections, you will need at least 12 variables in 12 formulas, one for each section.

For example the formula @StoreIntro might be:

WhilePrinting Records;
NumberVar PIntro := PageNumber

This would go at the top of the section that the Introduction starts in.

Then to display this on your TOC you will need another formula like @DisplayIntro:

WhilePrinting Records;
NumberVar PIntro

You will one of these for each page number you want to capture. For items that might need a page range, you will need another variable and formula, placed at the end of the section. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
I agree with Ken....the best you can get from this style of report is the page numbers for each section.

His approach is the one to follow. JimBroadbent@Hotmail.com
 
Top of the section means where will I have to put the @storeIntro formula in? And do i have to put all the Dipslay formulas of different sections in txt boxes in TOC?


Please reply immediately

Thanking you in advance

longfellow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top