Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I used formula as indexbuild syntax as below for generating table of content........
 
WhilePrintingRecords;
shared StringVar Array catArry;
shared NumberVar Array pageArry;
IF NOT (GroupName({Ledger.ACCODE1})& "-" & mid({Ledger.name1},1,100) IN catArry) THEN (
Redim Preserve pageArry[UBound(pageArry) + 1];
pageArry[UBound(pageArry)] := PageNumber;
Redim Preserve catArry[UBound(catArry) + 1];
catArry[UBound(catArry)] := trim(ToText ((GroupName ({Ledger.ACCODE1})))) & "-" & mid({Ledger.name1},1,100);
);
"";
 

-----------------------------------------------------------------------------------
I used formula as indexprint syntax as below for Printing table of content........
 
WhilePrintingRecords;
NumberVar i;
NumberVar j;
shared StringVar Array catArry;
shared NumberVar Array pageArry;
StringVar Array Output;
Redim Output[UBound (catArry)];
FOR i := 1 to UBound (catArry) do (
Output[i] := mid(Left(CStr(ToText(pageArry[i],0))+" " + "|",5)+mid(catArry[i]+space(100),1,100) ,1,200);
);
Join(Output,CHR(13))
 

 
But it gives error a string can be most 254 characters long
 

another method is
 
1. Create a new table in your database called TableOfContents.
Create three fields in this table:
· Grouper (String data type)(Ensure this field is at least as large as your longest group field value)
· Page (Number data type)
· DateTime (DateTime data type)
 
2. Assign rights to write to, delete, and update this table to any users of this report. The TableOfContents table will be updated as the report changes.
 
3. On a grouped report (for this example the report is grouped on the ProductName field), in the 'Insert' menu, click 'Subreport'.
Name this subreport 'Table Of Contents'.
Connect this subreport to the new TableOfContents table and insert the TableOfContents.Grouper and TableOfContents.Page fields in the Details section.
Sort this subreport by the TableOfContents.Page field.
 
4. Insert the 'Table of Contents' subreport in the Report Header section.
 
5. Right-click the gray area to the left of the Report Footer, and then click 'Insert Section Below'.
There will now be 'Report Footer a' (RFa) and 'Report Footer b' (RFb).
 
6. In the Main report, on the 'Insert' menu, click 'Subreport'.
Name this subreport 'UpdateTOC'.
In the 'Database Expert' dialog box, browse to your Table of Contents data source, then double-click 'Add Command'.
The 'Add Command to Report' dialog box will appear.
 
7. Click the 'Create' button to create a parameter.
Name the parameter 'LinkReceiver' and click 'String' from the 'Value Type' drop-down box.
Create another parameter named 'DateTime' with a 'DateTime' value type.
 
8. In the 'Add Command to Report' dialog box enter a SQL Query similar to the following:
{?LinkReceiver}
DELETE FROM "TableOfContents" WHERE "TableOfContents"."DateTime" <> {?DateTime};
SELECT * FROM "TableOfContents"
 
This command object will add new GroupName and PageNumber data to the TableOfContents table and delete any existing data based on the ?DateTime parameter.
 
9. Insert the Grouper and the Page fields in the subreport Details section.
Suppress all of the subreport sections.
 
10. Insert the 'UpdateTOC' subreport in the Report Footer B (RFb) section.
(This is to ensure that the formula used to link the subreport is processed before the subreport is processed.)
 
11. Right-click the 'UpdateTOC' subreport, and then click 'Format Subreport'.
Click the 'Border' tab, and then click 'None' from the 'Left', 'Right', 'Top' and 'Bottom' drop-down boxes.
 
Click 'OK' to close the 'Format Editor' dialog box.
 
12. In the main report, create a formula named 'DateTime' with the following syntax:
CurrentDateTime
 
13. Insert this formula in the main report's Report Header section.
 
14. Create another formula named 'LinkMaker' with the following syntax and place it in the Group Header section of the main report:
WhilePrintingRecords;
StringVar link;
If Not InRepeatedGroupHeader Then
link := link & "INSERT INTO TableOfContents VALUES ('" &
GroupName ({Product.Product Name}) & "'," &
ToText(PageNumber,0) & ",'" &
ToText({@DateTime}, "yyyy-MM-dd HH:mm:ss") &
"')" & chr(10);
link
 
NOTE:
The output of this formula will look similar to this:
INSERT INTO TableOfContents VALUES ('Bikes',1,'2003-04-04 12:32:01')
INSERT INTO TableOfContents VALUES ('Locks',2,'2003-04-04 12:32:01')
 
NOTE:
If changes are made to the report that affect the page numbering, refresh the report twice to update the TableOfContents table.
 
15. Create another formula named 'LinkPasser' with the following syntax and place it in the Report Footer A (RFa) Section of the main report:
WhilePrintingRecords;
StringVar link;
link
 
16. In the main report, in the 'Edit' menu, click 'Subreport Links'.
In the 'Subreport Links' dialog box click the 'UpdateTOC' subreport from the 'For subreport' drop-down box.
 
17. Click the '@DateTime' Formula field from the 'Available Fields' box and move it to the 'Field(s) to link to' box.
In the 'Subreport parameter field to use' drop-down box, click the '?DateTime' parameter.
 
18. Repeat step 15, connecting the '@LinkPasser' Formula field to the '?LinkReceiver' parameter.
 
Click 'OK' to close the 'Subreport Links' dialog box.
 
19. In the 'Field Explorer' of the main report, click 'Special Field'.
Insert the 'PageNofM' field in the Page Footer.
 
20. Preview the report to write the Table of Contents data to the database.
 
21. Refresh the report again and the Table of Contents will display the group and page number values based on your report.
 
----but there is same error
 

----if u have another method to generate table of contents then please give me a solution for more then 600 or 10000 pages
Posted 22-May-13 20:31pm
Hitu55328
Comments
thatraja at 20-Oct-13 2:58am
   
Got any solution?, share it here if you have

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 545
1 OriginalGriff 285
2 Shweta N Mishra 244
3 Mathew Soji 225
4 BillWoodruff 200
0 OriginalGriff 6,153
1 Sergey Alexandrovich Kryukov 5,758
2 DamithSL 4,958
3 Manas Bhardwaj 4,539
4 Maciej Los 3,735


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100