The information in this article applies to:
- Microsoft Visual FoxPro for Windows, version 3.0
- Microsoft FoxPro for Windows, versions 2.5x, 2.6x
- Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x
- Microsoft FoxPro for Macintosh, versions 2.5x, 2.6a
SUMMARY
By using the Report Writer in FoxPro, you can limit the number of records
that print in the Detail band when the report has a data grouping.
MORE INFORMATION
FoxPro 2.x Example
The steps below demonstrate how to print only the first ten records from
each state in the CUSTOMER database, in a report that is grouped on the
STATE field:
- In the Command window, issue the following commands:
USE <FoxPro_directory>\tutorial\customer
CREATE REPORT
- From the Report menu, choose Quick Report, and then choose OK.
- From the Report menu, choose Data Grouping.
- Choose Add, and then set up the data grouping on STATE.
- From the Report menu, choose Variables.
- Choose Add, and then create a variable named Count. Assign it an
initial value of 0 and a value to store of 1. Under Calculate, select
Count, and set Reset to State.
- For each field in the Detail band, set up the expression as follows:
IIF(COUNT<=10,<fieldname>,"")
- If you are using FoxPro for Windows or FoxPro for Macintosh, choose
the Print When check box from within the Report Expression dialog box,
and select Remove Line If Blank.
If you are using FoxPro for MS-DOS, choose Page Layout from the Report
menu, choose Options, and then select the Suppress Blank Lines check
box.
- Add or move the STATE field to the body of the state data grouping
header.
- From the Report menu, choose Print Preview to see your example.
Visual FoxPro Example
- In the Command window, issue the following command:
USE c:\vfp\samples\data\orders
- From the Window menu, choose View Window.
- Select the Orders table and click Properties.
- From the Index Order list box, choose CUST_ID, then choose OK.
- In the Command window, type:
CREATE REPORT
- From the Report menu, choose Quick Report, and then choose OK.
- From the Report menu, choose Data Grouping.
- Type "Cust_id" (without the quotation marks) under the Group Expression
list box and choose OK.
- From the Report menu, choose Variables.
- Create a variable named Count. Assign it an initial value of 0 and a
value to store of 1. Under Calculate, select Count, and set Reset to
CUST_ID.
- For each field in the Detail band, set up the expression as follows:
IIF(COUNT<=10,<fieldname>,"")
- If you are using FoxPro for Windows, FoxPro for Macintosh or Visual
FoxPro 3.0, choose the Print When check box from within the Report
Expression dialog box, and select Remove Line If Blank.
- Add or move the CUST_ID field to the body of the state data grouping
header.
- From the Report menu, choose Print Preview to see your example.
|