Related Information Examples & Tutorials

How To Number Pages And Records

This topic discusses numbering pages and records in reports.

Requirements

- Familiarity using the Report Writer in Collect!
- Understanding of Lists, Loops and Variables

Top of page.

List Count

When you are looping through records in a report, you can insert the following code at the beginning of your line of data and it will display the number of the record you are printing. For instance, if your report displays 10 items in a list, they will be numbered from 1 to 10 by using this control code.

SYNTAX: @n - print the current item number in a list.

tip.gif Please note that this is only valid within the body of a loop.

Example:

@cl.de
@n @de.na<30> @de.li @de.ow<12>
@cl.de

This short example loops through a client's debtors, numbering them as they are displayed. It then prints the total number of Accounts printed and also a total Owing. Please see How To Use Totals In Reports and How To Use Loops for additional tips.

Example using a variable:

This example produces the same output using a variable to increment the counter.

@varNum# = 0
@cl.de
@varNum = @(varNum+1)
@varNum<3> @de.na<30> @de.li<10> @de.ow<12>
@cl.de

Please see How To Use Variables for more information.

Sample Output:

1Elliot, Randall 05/20/2002$5,732.70
2Gonzales, Hernando06/10/2002$150.30
3Hirsch, Henry04/21/2002$2,456.00
4Kuebler, Dennis04/14/2002$3,460.00
5Louis, Theodore06/03/2002$2,340.00
6Mayes, John05/24/2002$1,360.00
7Nadeau, Pierre06/10/2002$5,984.53
8Raab, Tara03/03/2002$7,094.60
9Rocca, Rachel05/13/2002$2,232.87
10Scott, Sandra R.04/25/2002$1,560.70
11Selinas, Christopher06/10/2002$5,680.00
12Uhl, Thomas06/10/2002$780.00
13Wells, Les03/29/2002$8,272.04

tip.gif To count records and display a total completely outside of the loop, you will have to use variables. Please refer to How To Use Static Variables for more information.

Top of page.

Page Number

This prints the Page Number. You can place it in the report body wherever you want the number to appear. For instance, upper left corner, or upper right corner or bottom center.

SYNTAX: @p - Print the current page number.

tip.gif For running page numbers, put the @p in a Footer.

Top of page.

New Page

There are several ways to force a new page in your report.

Top of page.

Form Feed

SYNTAX: @f - Tells the report writer to do a form feed.

This code inserts a <NEW PAGE> command at its location in the report body. This forces the report to advance to a new page before continuing to print.

tip.gif This is useful to force information to appear on a new page for each record pulled from the database.

Top of page.

Form Feed At Line Number

SYNTAX: @fxx - do a form feed if the line number on this page is equal to or greater than xx.

For example, @f65 means form feed after 65 lines on this page.

tip.gif There must be no space after the @f.

Top of page.

Form Feed With Footer

SYNTAX: @fo - print the footer and eject the page.

This command tells the report writer to print the footer that was designed for this report through the Footer button at the top of the Report Definition form.

Top of page.

Page Orientation

When you are viewing the Report Definition form for a specific report or letter, you can access the Report Options form by pressing the Options button at the bottom of the Report Definition form. Please refer to help on Report Options for details about setting page orientation using the fields in this form.

Top of page.

See Also

- How To Use Loops
- How To Print A List of Records
- How To Use Static Variables
- How To Use Totals In Reports
- Report Topics Index for a list of all report and letter topics
- Report Sample to view sample reports and letters

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments: helpinfo@collect.org