Chapter 1. Overview of Panther Reports

Part of the Panther framework is a Panther tool to build and generate reports. You create the reports in the Panther editor. Once created, a report can be invoked from an application, from a Web browser, or on the command line, and can be output to the screen, to a printer or to a file.

Reports differ from applications in their database access requirements. The database connection will be maintained until the report has retrieved and processed all necessary data.

The Panther editor does not put default extensions on report filenames. The examples in this manual have the extension .rpt; it can be convenient to add an extension, so that reports can be quickly identified in the list of application screen and report files in the library. These examples are based on the vbizplus database. For a description of this database, refer to Appendix B, "Reports Sample Database."

Report Definition: A Composite View

The Panther editor offers two views into a report file: the physical layouts are shown in the layout window, while the specifications for report generation are schematically rendered in the Report Structure window.

A simple report, which is built in Chapter 4, "Building a Sample Report," looks like this:

Panther's unique method of defining a report, which separates layout from execution, gives you complete control over the format and sequence of output at all stages of execution. For example, you can call a function at any stage of report execution by inserting a call node at the corresponding point in the report structure. This function might be used to change the layout area that a print node invokes at runtime, or to conditionally skip over a portion of the report structure.

You can make reports as simple or complex as you like. Most reports, like the one shown earlier, require a basic structure with only a few nodes. The real power of Panther lies in the properties that you can set on individual nodes and widgets. For example, you can prevent page breaks within groups by setting the appropriate group node's Keep on Page property to Yes, or specify a widget to output subtotals simply by setting its Value and Value Source properties.

For the basics of using the report layout window, refer to Chapter 2, "Introducing Report Layout," and for the structure window, refer to Chapter 3, "Introducing Report Structure."

Report Wizard

The report wizard is the easiest tool for creating reports. Reports created with the wizard rely on the transaction manager to fetch their data. The report wizard automatically creates the necessary widgets, links, and table views.

You can easily modify reports after creating them with the wizard.

Refer to Chapter 5, "Report Wizard," in Using the Editors for an introduction to the report wizard. For more information on the transaction manager, start with Chapter 31, "Building a Transaction Manager Screen," in Application Development Guide.

Data Access

Reports that get their output from a database can take advantage of Panther's transaction manager to generate the appropriate SQL. Alternatively, you can write your own SQL statements. In either case, Panther's database drivers interpret the SQL and fetch the data you want.

The report can also receive data as a bundle from your application, or you can write your own custom function to fetch data from other sources, such as flat file databases, that are not directly supported by Panther.

In the three-tier environment, a report run on the server uses that server's database connection. If a report is run locally on the client, a database connection must be opened as it is in the two-tier environment.

Automatic Calculations

At runtime, Panther can automatically capture report data as it is output and use it to calculate subtotals and totals. It can also copy output to other locations in the report, or use an array to collect a series of output values.

You can also write your own functions to process output–for example, to calculate summary data such as averages, maximums, and minimums, or to control report execution by changing node properties at runtime.

Modular Architecture

A report file can contain one or more report definitions. These reports are accessible to each other and to reports in other files. So, you can build a report that is entirely defined in a single file, or one whose components are partially derived from other report files. This is particularly useful for objects that have the potential for being reused by different reports–for example, layouts for title and trailing pages, or inserted reports.

A report can access the contents of another report file in two ways:

Cross-Platform Portability

You can create and run reports on any platform supported by Panther, including Windows, Motif, and on various character-mode platforms. Reports that are created on one platform can be run on another without editing; Panther handles all cross-platform issues such as font mapping to ensure equivalent output on all platforms.

Report Deployment

While you are developing your report, you can preview its output at any time. You can either view reports at your terminal through the editor's viewer, or you can send output to a file or printer. In Windows and Motif, the viewer accurately shows what you can expect from printed output. Because the viewer is integrated within the editor, you can respond immediately to the viewer output, then run the report to the viewer again to see how your changes look.

You can also use Panther's debugger when you run reports in the editor–for example, to display the current value of an output widget.

When the report is complete, you can either run it from the command line, using the rwrun utility, or call it from within a Panther application. For more information, refer to Chapter 9, "Running Reports," and Appendix A, "Report Utilities." In the three-tier environment, you can set up reports to run locally on the client or remotely on the application server.

The output options include drivers for the Windows printer drivers, Adobe PostScript, HTML, PDF, XML, ASCII text and ReportWriter's platform-independent metafile format.