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 2

Status
Not open for further replies.

ccding

MIS
Jul 10, 2007
41
0
0
US
Hi all - Crystal Reports XI - SQL Server Database:
How do you create a TOC with 2 Group Headers?
Group Header 1: Category.... Page Number
then Group Header 2: CustomerName (indented under Category)... Page Number

?? Thannk you
 
Thanks for that direction - not sure if I can use that post though. Could anyone give me more of a step-by-step for the TOC? I do not want to edit registry, nor create any additonal table in the database.
--
All Help Greatly Appreciated ! Thanks.
 
Does the TOC have to be page 1 of the report, or could it be at the end? Are you saying that you want page numbers and indentations, etc., based on your main report that has these two groups?

-LB
 
Thanks Lbass,
Yes, It can be at the footer or end.
Yes page numbers based on the main report.
So something like this: (Pg Nbrs respective to page location of CustomerName)

Table of Contents
PgNbr
Category1
CustomerName1........1
CustomerName21......13
CustomerName36......35
etc.

Category2
CustomerName4........1
CustomerName17.......9
CustomerName48......23
etc.

If I can take this report into more advancement, the report would ideally look something like this (in 3 columns, aligned well):

PgNbr PgNbr PgNbr
Category1
CustomerName1.....1 Customer37...36 Customer7...51
CustomerName21...13 Customer41...47 Customer8...62
CustomerName36...35 Customer52...49 Customer9...75
etc.

Category2
CustomerName4.....1 Customer49...30 Customer55...55
CustomerName17....9 Customer50...41 Customer61...60
CustomerName48...23 Customer53...49 Customer80...77
etc.

Thank you for any help !!
 
Can you tell me about how many categories and about how many customers there are in total?

-LB
 
sure, thanks,..

About 12 unique Cateogories,
And about 50 CustomerNames per Category (and growing).

The amount of CustomerNames vary per Category, so Category1 could have 100 CustomerNames; while Category2 could have 22.

Currently, there are about 500 CustomerNames in the Customer table (but growing.)
 
Okay, assuming you have a group on category and then a group #2 on customer name, create a formula and place it in the customer name group header:

whileprintingrecords;
shared stringvar array categ;
shared numbervar array categno;
numbervar i := i + 1;
shared stringvar array cust;
shared numbervar array custno;
numbervar j := j + 1;

if 1 < 1000 then (
redim preserve categ;
if not({table.category} in categ) then (
categ := {table.category};
redim preserve categno;
categno := pagenumber;
)
);
if j < 1000 then (
redim preserve cust[j];
if not({table.customername} in cust) then (
cust[j] := {table.customername};
redim preserve custno[j];
custno[j] := pagenumber
)
);

Insert a subreport in the report footer that uses the same tables and selection criteria and insert a group on category and a group on customer name. Suppress all other sections. Then create these formulas:

//{@displcateg} to be placed in GH1:
whileprintingrecords;
shared stringvar array categ;
shared numbervar array categno;
numbervar k := k + 1;
numbervar displcateg;

for k := 1 to ubound(categno) do(
if categ[k] = {table.category} then
displcateg := categno[k]
);
displcateg

//{@displcust} to be placed in GH2:
whileprintingrecords;
shared stringvar array cust;
shared numbervar array custno;
numbervar m := m + 1;
numbervar displcust;

for m := 1 to ubound(custno) do(
if cust[m] = {table.customername} then
displcust := custno[m]
);
displcust

If any of the arrays exceed 1000 elements, you would have to modify the formulas.

-LB
 
Great, I will try this. Thanks again for your help !!
 
I forgot the last step. In the subreport, go to the section expert->details->format with multiple columns->layout tab->set width and gap->down then across->check "format groups with multiple columns". This would give you:

Category 1 CustomerName49...42
CustomerName1.....1 Category 3
CustomerName18...12 CustomerName8... 44
CustomerName21...13 CustomerName9 ...46
CustomerName36...35 //etc.
CustomerName37...36
Category 2
CustomerName4....37
CustomerName17...39

If you really need the categories in separate sections, then you could either reference only one category per subreport (add a separate subreport for each, and formatting the sub so that it cannot grow--in order to force the columns within a specified height), or, you could collect the results of {@displcust} in another variable that includes returns, is formatted to can grow, and is displayed in GF1.

There is a way to add in the dots, too, but it depends upon which display option you choose.

-LB
 
Thanks LBass !
That is what I needed to do. It is working well!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top