Chapter 7. Reports

Table of Contents

A simple report
The report field
User defined report sections - a more complex report
Subreports
Show reports depending on form values

A good database frontend is not complete without the ability to produce reports. In this chapter we will learn how to create neat reports. Before starting, you should have a look at ??? to set some important preferences.

Double-click "Reports" in the list view. The reportdesign window is displayed and the Property Editor dialog window is opened. The reportdesign window has a vertical toolbar on the left hand side.

Figure 7.1. The reportdesign window

The reportdesign window

So far it looks similar the "formdesign" window, but with some differences. Before you start designing reports, you should already be knowledgeable on form creation. See Chapter 6, Forms for details.

  • The left toolbar provides only one fieldtype

  • The design area is divided into areas known as sections

Reports are divided in sections in which reportdata can be displayed. There are two section types:

  • predefined sections with special meaning

    • the "reportbeginsection" and "reportendsection". These will only will be shown once, the "reportbeginsection" is displayed BEFORE all the datasources' data is be displayed, and its equivalent "reportendsection" is displayed at the very end of the reportdata

    • the "pageheader" and a "pagefootersection": which, as the name suggests, will be displayed on each page as header or footer

    • the "datasection" (main data section and the only section without a sibling). This section will be printed for every row in a datasource

  • user defined sections, to group the data: they _always_ exist as pairs, a headersection and a footersection. Headersections will be printed before the datasection, footersections after the datasection. It is necessary to define a column for these sections. The sections will be printed when the value of the column changes

First let's try to create a simple report.

A simple report

First select the datasource ("literature" table) on which the report depends. To do this you have to change the report properties. To access the report properties, nothing else must be selected. Click somewhere in the dark grey area outside the sections. To set the datasource see the section called “The property editor” for details.

Now let's create a new field. Select 'new field' (on the toolbar on the left) and follow that by clicking an area in the datasection (make sure it is the datasection and not one of the others). Set the 'title' column in the property editor. To preview what we have done, change to viewmode. Congratulations. You have created your first report.