Introduction Reporter Commands Index

Introduction to The Reporter

The Reporter command language provides a simple way to create custom reports. While there are more than two dozen commands available, many reports can be created by using just a few of the commands. The Report editor can help you create the command file.

The editor is launched when you click either the "Edit Report" or "New Report" buttons in DX. You can also start it directly by running "DATAEXP".

To get you started using the new Report editor, here are a few hints.

DataExpress screen shot

The Reporter Command Language

The Reporter command file is stored in a Comet file, preferably a text file with a ".ibr" extension. Often a report can be defined with just a few commands. For example, the following group of commands prints a customer list using data from the CUSTOMER data file:

  INPUT CUSTOMER
  REPORT
  PRINT CUST.NUMBER;CUST.NAME;ADDRESS;CITY;STATE;ZIP
In the above example, the INPUT command specifies that data will be retrived from the CUSTOMER file. The REPORT command separates the INPUT command from the PRINT command. The PRINT command specifies which data fields will be printed. In this case, the customer number, customer name, address, city, state, and ZIP code will be printed.

Additional commands can be used to sort and select specific records. For example, to sort the customer list by ZIP code, you could add the SORT command to the report specification:

  INPUT CUSTOMER
  SORT ON ZIP
  REPORT
  PRINT CUST.NUMBER;CUST.NAME;ADDRESS;CITY;STATE;ZIP
Or, if you wanted to include just the customers from a certain state (in this case, California), you could include the SELECTING command:
  INPUT CUSTOMER
  SELECTING IF STATE = "CA"
  SORT ON ZIP
  REPORT
  PRINT CUST.NUMBER;CUST.NAME;ADDRESS;CITY;STATE;ZIP
Note: This example would select all of the customers from California and then sort those records by ZIP code.

Another frequently-used command is the TOTAL command. This command computes and prints column totals for numeric fields, as shown in this example:

  INPUT CUSTOMER
  REPORT
  PRINT CUST.NUMBER;CUST.NAME;AR.CURRENT;AR.OVER.30;AR.OVER.60;AR.OVER.90
  TOTAL AR.CURRENT;AR.OVER.30;AR.OVER.60;AR.OVER.90
The numeric fields named AR.CURRENT, AR.OVER.30, AR.OVER.60, and AR.OVER.90 are totalled and printed (in the appropraite columns) at the bottom of the report.

If you sort the records by a particular field, you can then create control breaks and display subtotals. This is done with the SORT command, the TOTAL command, and the BREAK command, as shown in this example:

  INPUT CUSTOMER
  SORT ON STATE
  REPORT
  PRINT CUST.NUMBER;CUST.NAME;AR.CURRENT;AR.OVER.30;AR.OVER.60;AR.OVER.90
  BREAK ON STATE
  TOTAL AR.CURRENT;AR.OVER.30;AR.OVER.60;AR.OVER.90
This report, which is sorted by STATE, will include control breaks and subtotals every time the value of the STATE field changes. Grand totals will be printed at the bottom of the report.

The Reporter can print data from multiple data files, as long as the appropriate link has been defined in the Comet data dictionary (#CFILES). The USING command specifies the link name that connects the primary file with one or more secondary files. The following example shows how data from the CUSTOMER file and CUSTOMER.HIST file can be printed on the same report. The link name for this example is CUST.TO.HIST.

  INPUT CUSTOMER
  REPORT
  USING CUST.TO.HIST
  PRINT CUST.NUMBER;CUST.NAMES;SALES.LAST.MONTH;YTD.SALES
Other Reporter commands control where the report is printed, how the report is displayed (including control over the number of lines per page, number of spaces between each column, number of indented spaces, number of blank spaces between print lines, etc.), the definition of virtual fields (expressions), the definition of report title lines, and more.

Copyright © 1995-2008 by Signature Systems, Inc.