Results 1 to 2 of 2

Thread: [RESOLVED] Create Index Page (Table of Content)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Resolved [RESOLVED] Create Index Page (Table of Content)

    I am using CR 9.1 shipped with VS.NET 2003,I want to know is it possible to create the Index page (Table of Content) in Report Header which will show Field Value (of Group by Column) and Starting Page No.

    For e.g I have My data come from two table OrderMaster and OrderDetail and in Report i have Group section based on OrderMaster No.,and Each group will start on new page,so how i can show all OrderMaster No and it's Starting Page no in Index.

    any link or suggestion will be helpfull
    __________________
    Rate the posts that helped you

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Create Index Page (Table of Content)

    If anyone looking for solution:

    First build the TOC ...
    To create the TOC, you first need a formula which collects the group names and their corresponding page numbers and stores them in a pair of global string variables. The formula, which is placed in the group header band, looks something like this:
    Code:
     
    global stringvar strTOC1; 
    global stringvar strTOC2; 
    local stringvar strTemp;
    
    if not InRepeatedGroupHeader then
      ( strTemp := {OrderMaster.OrderNo} + chr(10) ;
      if len(strTemp) + len(strToc1) <= 254 then 
        ( strToc1 := StrToc1 + strTemp; 
        strToc2 := StrToc2 + 
          totext(PageNumber,0) + chr(10) ))
    The formula declares two global strings variables. The first of these, strToc1, holds the group names (the country names in this example) separated by line-feed characters. The line-feeds ensure that each name will appear on a separate line within the table of contents. Before adding each new group name to this string, we check to see if it has reached the limit of 254 characters. If it has, no further names are added.

    The second string, strToc2, holds the page numbers, converted to text. These too are separated by line-feed characters.

    You might be wondering why we didn't choose to build a single string containing both the group names and the page numbers. This is a matter of alignment. Given that the group names vary in length, there would have been no way of getting the names and the numbers into two neatly aligned columns if they had been in the same string. Creating two separate strings solves that problem.

    After you have added the above formula to the group header section, be sure to suppress it to avoid spurious output appearing in the group header.

    ... Then display it
    To display the TOC, we need two further formulae, both of which are extremely simple. The first simply returns the contents of the group name string, like so:

    Code:
    whileprintingrecords;
      global stringvar strTOC1; 
      strToc1
    The other formula, which is almost identical to the first, returns the contents of the page number string:

    Code:
    whileprintingrecords;
      global stringvar strTOC2; 
      strToc2
    Place these two formulae in the report footer section. Position them side by side, and line them up along their top edges. Be sure to enable the Can Grow option for both formulae (do this from the Common page of the format editor). To improve the alignment of the page numbers, right-justify the second of the two formulae. Finally, add a suitable text object (such as 'Table of Contents') to label the TOC.


    Reference
    __________________
    Rate the posts that helped you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width