PRB: Report Duplicates Parent Records in One-to-Many

ID: Q88602

2.00 2.5x 2.60 2.60a | 2.5x 2.60 2.60a | 2.5x 2.60a

MS-DOS               | WINDOWS         | MACINTOSH
kbprg kbprb

The information in this article applies to:

SYMPTOMS

If a parent-child one-to-many relationship is set between two databases and a report is created that prints only parent records, the parent records will be duplicated in the detail line as many times as there are related child records. For example, if a parent record has three associated child records, the parent record will be repeated three times on the report.

RESOLUTION

Set SKIP to OFF to terminate the one-to-many relationship. If this is not feasible, choose Data Grouping from the Page Layout menu and set up a grouping on the related field. Then move all parent record fields to the group header or footer band.

STATUS

This behavior is by design.

MORE INFORMATION

The following is an example using the CUSTOMER and INVOICES databases in the TUTORIAL subdirectory.

1. Set up the one-to-many relationship.

2. Create a report with a data grouping on the CNO field in CUSTOMER. Place

   the desired fields in the group header and/or group footer band.

3. In the Detail band, place information from INVOICES. In the Summary
   band, add JUNK().

4. Save the report.

5. In the Command window, issue the following command to create JUNK.PRG:

      MODIFY COMMAND junk

6. Type the following commands in JUNK.PRG:

      SET SKIP TO
      SUM ytdpurch TO test
      RETURN test

7. In the Command window, issue the following command:

      SET PROCEDURE TO junk

8. Issue a SET FILTER command if needed.

9. In the Command window, issue the following command:

      REPORT FORMAT <filename> PREVIEW

The correct total from the parent table should now be displayed.

Additional reference words: FoxDos FoxWin FoxMac 2.00 2.50 2.50a 2.50b 2.50c 2.60a KBCategory: kbprg kbprb KBSubcategory: FxprgGeneral

Keywords          : FxprgGeneral 
Version           : 2.00 2.5x 2.60 2.60a | 2.5x 2.60
Platform          : MACINTOSH MS-DOS WINDOWS

Last Reviewed: April 30, 1996