The information in this article applies to:
SUMMARYUsing FoxPro's Report Writer, you can produce a report that displays records from databases engaged in a one-to-many relationship. In a one-to- many relationship, the parent record prints once and all corresponding (related) child records print out. MORE INFORMATIONThe following code opens the INVOICES and DETAIL database files, sets the order in the child database based on the INO field, and establishes a one- to-many relationship. In this example, INVOICES.DBF is the parent database and DETAIL.DBF is the child database.
NOTE: If you have a parent-child-grandchild relationship, you will need to
SELECT the parent and SET SKIP TO both the child and the grandchild. For
example:
Using the data grouping band is an easy and intuitive method of producing a
one-to-many report. The data grouping must be based on the field that
relates the two databases. In the example above, the invoice number (INO)
field links the INVOICE and DETAIL databases.
After you have established the previously described one-to-many relationship, do the following to create a one-to-many report:
The data grouping band executes each time the data grouping changes. For example, when the INO field changes its value, the fields within the data group header print. This functionality causes the parent record data to print one time. The Detail band of the report contains the fields from the child (DETAIL.DBF) database. This band executes each time a child record is available. Additional query words: FoxMac FoxDos FoxWin RWriter
|
|
Last Reviewed: August 23, 1999 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |