10. Using Report-Writer : Report Preparation : Headers and Footers in a Report
 
Share this page                  
Headers and Footers in a Report
Headers and footers are sections of your report code where you put instructions to tell Report-Writer what actions it must perform at the break for that part of the report.
You can specify headers and footers for the report itself, for page breaks, and for those columns you have designated as break columns. The page header appears at the top of each page, except the first. The only header you can specify at the top of the first page is the report header.
If you specify break columns, the header section is executed each time the column value changes, and the footer section is executed before the new value of the column is retrieved.
Report-Writer performs the specified footer actions after it has processed all rows in a group of data (indicated by the break designation). For instance, you can specify a footer action to occur after Report-Writer has read all rows for the entire report, all rows which can fit on a page, or all rows having the same value in the specified break column.
The footer section often contains instructions for calculating and printing subtotals or other summary information at the designated break. The special functions used to calculate this information are called set functions or aggregates, which you specify in print statements. A header action, if specified, can occur at the start of the report, at the start of a new page, or before the next group of data is processed.
You can specify both footer and header actions to occur in response to a change of value in a break column. Report-Writer performs the footer actions on the previous group of data rows and the header actions for the group yet to come. At the end of the report, however, Report-Writer performs only footer actions, because there is no more data. Similarly, at the start of the report, a break in each of the break columns occurs and Report-Writer can perform header actions for each of the major to minor break columns. However, because there is no previous group of data, footer actions are not relevant.