Previous Topic: How to Create a Report Template

Next Topic: Layout Statements in Report Templates

Block Statements

Block statements provide the report template with its framework. They define the data to be manipulated and control the execution of the report. Block statements begin with a name that must be unique throughout the report template. They then have the following two sections:

Data query section

Contains SQL SELECT, WHERE, and SORT clauses to define which data is fetched from the database.

Output program section

Defines the actions that are to be performed on the fetched data. It contains variable declarations, functions, and other block statements, including nested statements, which can be used to create conditional reports. It can also contain layout statements, which format and print the data as ASCII text.

A simplified version of the syntax of a block statement that shows the relationship between the two sections follows:

BLOCK blockname ("SELECT clause", "WHERE clause")
   SORT clause {output program statements}

The BLOCK in the Reference section discusses the detailed version of the syntax, along with a description of each clause and parameter.