Creating a Batch Report

This topic introduces the concept of Batch Reports. A Batch Report is a report that requires more than one trip back to the database server in order to complete. For example, when generating a large report, data can be sent to the printer in batches. The batch size depends on the BASIC program. It could be a line, a paragraph, a page or any quantity of data defined by the way the BASIC program is written.

To create a Batch Report:
  1. Start the report and return the first batch of data.

When the data is returned, keep the connection alive by using a persistent time out in the BASIC program.

  1. Trigger an event back from the client window to the server to continue processing, then return the next batch of data.

  2. Do one of the following:

NOTE

Triggering an event back to the server is not done automatically. It can be done using a Push button or a progress bar. With the progress bar, the status of the printing progress can be displayed.

The Batch Report program example generates a simple Customer list report using the Customers file located in the SQLDEMO account. The batch size is set to each record.

NOTE

Before proceeding, complete the procedures described in Creating a Simple Report.

To create a duplicate copy of the rREPORT1 Report:
  1. Right-click the rReport1 Class from the Report1 Library and select Duplicate.

A duplicate copy of the rReport1 Class displays.

  1. Type rReport2 to rename the duplicate copy.

  2. Select MyServer (Default) > Subroutines > mvDReport > bp > SimpleReport from Enterprise Browser.

  3. Right-click SimpleReport, then select Duplicate Item.

A duplicate copy of the SimpleReport BASIC program is created.

  1. Type BatchReport to rename the duplicate copy.

To create the BatchReport program:
  1. Double-click BatchReport node to open the BASIC Editor.

  2. Edit the BatchReport BASIC program to enable batch printing.

NOTE

w3mvDInput in the StartBatchReport routine is a persistent input with a 20 second time-out.

To compile and catalog the BASIC program:
  1. Click Compile.

The BatchReport BASIC program successfully compiles.

  1. Select the MyServer (Default) > mvDCatalog > BatchReport node from the Enterprise Browser.

  2. Right-click BatchReport and select the Catalog Item...

The mvDCatalog Entry window displays.

  1. Select the Allow Anonymous Access check box.

  2. (Optional) Type Batch Report Printing Example in the Description field, then click Save.

To design the mvD window design form:
  1. Double-click wWindow1 Class to open the REPORT1.wWindow1 design form.

  2. Select the Print Report button and align it below the Print from BASIC button, then drag the Push Button from the Component Store to the REPORT1.wWindow1 design form.

  3. Type Start Batch Report in the Text field of the Property Manager window.

  4. Drag the Progress Control from the Component Store to the REPORT1.wWindow1 design form.

  5. Type ProgressBar in the Name field, then select KBorderInset from the effect drop-down list in the Appearance tab to define the field properties for the Progress Control in the Property Manager window.

  6. Select a color from the progressColor field and the ::backcolor field located in the Custom tab, then select False from the Vertical and Blocks drop-down lists.

The ProgressBar component has a run time property (sendCarryOn), which when set to kTrue automatically triggers the evCarryOn event. The evCarryOn event triggers an event back to the server to request the next batch of data. While the data is being returned, the BASIC program also updates the current value of the ProgressBar to show the printing progress. While this is not necessary, it is a good idea to inform users that the system is performing other operations and cannot carry out any requests at this time.

To assign the mvD window events:
  1. Select MyServer (Default) > Reports > REPORT1.rReport2 node from the Enterprise Browser.

  2. Drag the REPORT1.rReport2 node to the Start Batch Report button in the REPORT.wWindow1 design form.

The wWindow1_1033 window displays.

  1. Select the evClick event and the Start New Print Job check boxes, then select the Print in Batches option and Screen from the Print Destination drop-down box.

  2. Click Update to save the changes.

  3. Select MyServer (Default) > Reports > REPORT1.rReport2 node from the Enterprise Browser, then drag the REPORT1.rReport2 node to the ProgressBar.

The ProgressBar event window displays.

  1. Select the evCarryOn event check box, then click Update to save changes.

NOTE

The Start New Print option must not be selected.

To assign the mvD report events:
  1. Double-click rReport2 Class from the REPORT1 Library.

The REPORT1.rReport2 design form displays.

  1. Select MyServer (Default) > mvDCatalog > ReportTutorial > BatchReport node from the Enterprise Browser.

  2. Drag the BatchReport node to the record in the REPORT1.rReport2 design form.

The rReport2 event window displays.

  1. Select the $getreportdata check box, then click Update to save changes.

To run the Batch Report:
  1. Right-click REPORT1.wWindow1 design form, then select Open Window.

The REPORT1.wWindow1 design form runs.

  1. Click Start Batch Report to generate the Batch Report.

While the batch report generates, it displays progress information on the tandem port by the telnet session.

See Also

Generating Report in mvDesigner

Setting up the Development Environment

Creating a Simple Report

Modifying Fields at Run Time

Using the Report Data Grid

Using the Report Graph Control Component

Selecting Print Destination from BASIC

Summary

Examples