DECLARE-TOC

Syntax

DECLARE-TOC toc_name [FOR-REPORTS=(report_name1[,report_namei]...)] [DOT-LEADER=YES|NO] [INDENTATION=position_count_num_lit] [BEFORE-TOC=procedure_name[(arg1[,argi]...)]] [AFTER-TOC=procedure_name[(arg1[,argi]...)]] [BEFORE-PAGE=procedure_name[(arg1[,argi]...)]] [AFTER-PAGE=procedure_name[(arg1[,argi]...)]] [ENTRY=procedure-name [(argi [,argi] ...)]] END-DECLARE

Description

Defines the table of contents and its attributes.

Use DECLARE-TOC in the SETUP section.

You can use the DECLARE-TOC command to declare one or more tables of contents for the application.

A table of contents can be shared between reports.

Parameters

Parameter Description

toc_name

Specifies the name of the table of contents.

FOR-REPORTS

Specifies one or more reports that use this table of contents.

DOT-LEADER

Specifies whether a dot leader precedes the page number. The default setting is NO.

INDENTATION

Specifies the number of spaces by which each level is indented. The default setting is 4.

BEFORE-TOC

Specifies a procedure to be run before the application generates the table of contents. If no table of contents is generated, the procedure does not run.

AFTER-TOC

Specifies a procedure to be run after the application generates the table of contents. If no table of contents is generated, the procedure does not run.

BEFORE-PAGE

Specifies a procedure to be run at the start of every page.

AFTER-PAGE

Specifies a procedure to be run at the end of each page.

ENTRY

Specifies a procedure that is run to process each table of contents entry (instead of SQR doing it for you). When this procedure is invoked, the following SQR-reserved variables are populated with data about the TOC entry:

#SQR-TOC-LEVEL contains the level.

#SQR-TOC-TEXT contains the text.

#SQR-TOC-PAGE contains the page number.

These are global variables. If the procedure is local, you must precede it with an underscore (for example, #_sqr-toc-page). These three SQR-reserved variables are valid only within the scope of the ENTRY procedure. They can be referenced outside the scope, but their contents are undefined.

Example

The following example illustrates the DECLARE-TOC command:

begin-setup
  declare-toc common
    for-reports=(all)
    dot-leader=yes
    indentation=2
end-declare
end-setup
.
.
.
toc-entry level=1 text=$Chapter
toc-entry level=2 text=$Heading
.
.

See BEGIN-FOOTING, BEGIN-HEADING, DECLARE-REPORT, TOC-ENTRY