Reports - Table of Contents, Bookmarks and Index Feature Pack

To purchase this Feature Pack, please click here

NOTE: This feature pack applies to developers of both desktop and web applications.

 

Watch Video - Part 1

Watch Video - Part 2

 

This feature pack allows you to add the following features to Reports that you create in Alpha Five:

You can completely customize the entries that are made in the Table of Contents, Bookmark section and Index. In addition, you can completely customize the layout of the Table of Contents section and Index section.

The entries that appear in the Table of Contents, Bookmark section and Index are 'live' - if you click on an entry, you will be navigate to the appropriate page in the report. In addition, when you print the report to a PDF file, the Table of Contents, Bookmarks and Index are live.

Here is how the Print Preview window looks in a Desktop application:

Notice that the bookmarks are shown in a tree control on the left of the window. A button on the toolbar allows you to toggle the display of the bookmark navigator on and off. The table of contents is shown at the start of the report. Clicking on any entry in the table of contents, or in the bookmarks bar will navigate to the appropriate page in the report.

 

Print Preview in Desktop Application - Showing the Bookmark navigator on left and Table of Contents at Start of Report

 

Here is how the index appears in the report:

Index shows in the body of the report at the end of the report, after the Report Footer has been displayed.

 

If you create a custom Index report you can customize the index entries so that they are grouped together:

Notice how in the screenshot shown below, the index is printed as a multi-column report.

Screenshot show index entries grouped together. Index was generated using a custom Index report that uses the report's 'multi-column layout' feature.

 

Here is how the generated PDF file looks when a report with a Table of Contents, Bookmarks and Index is saved to a PDF file.

 

How to Insert a Table of Contents, Bookmarks or Index into a Report

To insert a Table of Contents, Bookmarks section or Index into a Report:

After you select the 'Insert Table of Contents', 'Insert Bookmarks' or 'Insert Index' command, the appropriate builder appears.

For example, here is the builder for inserting a Table of Contents:

 

 

The 'Report Sections' column shows all of the sections (i.e. group breaks) in your report.

Every report has a Grand section and a Detail section. If your report has group breaks, then the 'Report Sections' list will contain an entry for each group break.

You can define entries in the Table of Contents, Bookmark section, or Index for each section of the report.

The example screen shown above is for the sample Invoice report in Alphasports. This report has one level of grouping on the Invoice_number field.

For each section in the report you specify two properties:

So, for example, in the screenshot shown above, when the report is printed, each time a new record in the 'Detail' section is printed, a new entry is made in the Table of Contents. This entry is the result of the expression: product->description. When the user clicks an entry in the Table of Contents, focus is given to the object called 'PRODUCT_ID' in the report's 'Detail' section.

 

Defining Bookmarks in the Grand Section

Defining Bookmarks in the Grand section (which comprises the Report Header and Footer) is slightly different than defining bookmarks in other report sections.

Unlike the other report sections which allow one bookmark entry, the Grand section allows you to define multiple bookmark entries.

For example, consider the case of a complex report that has a 3 page Report Header section with multiple objects in the Report Header. You might want to define bookmarks to take to the different parts of the Report Header.

 

 

When you click the smartfield, this dialog shown below opens up. Notice that it shows a list of all of the objects in the Report Header and Report Footer. You can define bookmarks for as many of these objects as you want.

In the example shown below, we have defined a bookmark for the object called TEXT8. The text of the bookmark in this case is a literal value. But, of course, it could be any Xbasic expression.

 

 

Customizing the Layout of the Table of Contents and Index

When you add a Table of Contents or Index to your report, the layout of these sections is determined automatically by Alpha Five. However, if you don't like the automatically generated layout, you can completely customize the layout by defining a special 'Table of Contents' report, or 'Index' report.

 

When you are defining the Table of Contents, you will notice that the builder has section that allows you to:

The same options are also available when you define Index entries.

These custom layout reports are just like any other Alpha Five report, except that they are not based on a table or SQL query. Instead they are based on the table of contents, or index entries in your report.

Here is how a custom Table of Contents layout report appears in the Alpha Five report editor:

Custom 'Table of Contents' Layout Report

Notice that the report has grouping levels for each group in your report.

The report fields are based on a special 'psuedo' table that has these fields:

 

 

The report layout has also calculated special calculated fields, toc_page, toc_H1, and toc_detail which have been placed in the report layout. These calculated fields are defined as follows:

 

In order to use roman page numbering for the Table of Contents pages, the special *to_roman() function is used.

Notice also that the calculated fields that appear in the report use this format:

literal entry that appears in the table of contents - followed by a tab - followed by the page number in the report

 

So, in the case of the toc_detail field, the calculated field is based on the 'detail' field (which contains the text entries that appear in the Table of Contents) and the 'detail_page' field which contains the corresponding page number for the entry.

If you right click on one of these objects on the report layout and show the Properties dialog, Setup screen, you will see that the object is formatted as a 'Table of Contents' (TOC) entry.

This causes Alpha Five to left justify the text, right justify the page number, and then fill in the space between the text and the page number with dots.

 

 

Where Custom 'Table of Contents' and 'Index' Layout Reports are Stored

In the case of reports based on .dbf tables, the custom 'Table of Contents' and 'Index' layout reports can be stored in either of two locations:

If you store a layout report in a local dictionary, then any other report that is based on the same table or set and that has the same 'structure' (see comments on 'Sharing Custom Table of Contents and Index Layout Reports' below) can use this layout report.

On the other hand, if you store a layout report in the 'global' dictionary, then any report (regardless of its data source) can share the layout report (as long as it too shares the same 'structure').

In the case of reports that are based on SQL data sources, you do not have any options - Alpha Five automatically stores the 'layout' report in the 'global' dictionary where the SQL report itself is also stored.

 

Sharing Custom 'Table of Contents' and 'Index' Layout Report Layouts

Custom 'Table of Contents' and 'Index' layout reports can be shared. For example, you might have designed two reports, 'Report1' and 'Report2'. As long as both reports have the same basic structure, a custom 'Table of Contents' report designed for 'Report1' can be  used for 'Report2'. If 'Report1' has 3 levels of grouping, for example, then if 'Report2' also has 3 levels of grouping, then the reports have the same structure (even though they may be based on completely different data sources).

In order to share a 'Table of Contents' or 'Index' layout report, the layout report must be stored in the same dictionary as the report you are defining. See comments above regarding where 'Layout' reports are stored.

The same comments apply to sharing 'Index' layout reports.

 

Formatting Index Entries to Combine Page Numbers onto a Single Line

The default Index report show a list of 'entries'. If there are duplicate occurrences of a single 'entry' in the report ,then duplicate entry/page pairs show up in the index. For example, if the term 'Alpha Five' appears in the report three times, there will be three entries in the Index.

The reason that duplicate entries are made in the Index (each with their own page number, of course) is so that navigation to the various pages in the report when the user clicks on an Index entry is unambiguous.

 

Instead of having multiple entries in your Index, you might prefer to group multiple Index entries together followed by a comma delimited list of pages in which the entry can be found. For example:

Alpha Five.......10, 23, 34

 

Note: When you group index entries as shown above, you sacrifice the ability to navigate to the individual pages show in the index entry. In the above example, you would no longer be able to navigate to page 10, 23 or 34 by clicking on each page's discreet index entry. You would only be able to navigate to page 34, the last page in the grouped list of pages.

In order to group Index entries as shown above, you need to:

1. Define a Custom Index Layout for your report

2. Define the following calculated field in the custom Index Layout report:

entrytext = entry-' '+strtran(*collect(alltrim(str(pageno)),grp->Entry),crlf(),", ")

 

3. Add a group break above the Detail section. Break on the 'Entry' field.

4. Turn off the report's Detail section.

5. Turn off the Group Header for the new group break you just added.

6. In the Group Footer for the new break, add the 'entrytext' calculated field.

7. If you think that the index entry may require wrap to the next line to accommodate the length of the index entry, turn on the object grow property, and turn on the word-wrap property.