Microsoft KB Archive/136674

= PRB: Can't Print GrandChild Records in One-to-Many Relation =

Article ID: 136674

Article Last Modified on 5/7/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q136674



SYMPTOMS
A report for three tables, where the tables have a parent, child, and grandchild one-to-many relation, does not display all the related records in the grandchild table for each of the records in the child table. Only the first related grandchild record prints.



RESOLUTION
To list all the related records in the grandchild table for each of the records in the child table:


 * Use the SET SKIP command. Place it in the Init event of the report's data environment to set the one-to-many relation from child and grandchild into the parent. -or-


 * Set the IntitialSelectedAlias property of the report's data environment to the child table.



STATUS
This behavior is by design.



Steps to Reproduce Behavior

 * 1) Open the Testdata Database that should be in the \Samples\Data directory under the Main Visual FoxPro directory.
 * 2) Create a new report, and call it Test.
 * 3) Open the data environment of the report and add the Customer, Orders, and OrdItems tables to it. Make sure the relation is set among these tables so that the Orders table is a child of the Customer table, and the OrdItems table is a child of the Orders table. The OrdItems table is the grandchild of Customer table.
 * 4) Set the OneToMany property of both the relations in the report data environment to true (.T.-True).
 * 5) Set the Order property of the Customer table to Cust_Id and the Order property of the Orders table to Order_Id.
 * 6) Set the InitialSelectedAlias property of the report data environment to the Customer table.
 * 7) Create a report group for Customer.Cust_Id and another report group for Orders.Order_Id.
 * 8) Place the Cust_Id and Company fields of the Customer table in the first group header (Customer.Cust_Id).
 * 9) Place the Order_Id and Order_Amt fields of the Orders table in the second group header (Orders.Order_Id).
 * 10) Place the Line_No,Product_ID, and Unit_Price fields of the OrdItems table in the Detail band.
 * 11) Add whatever titles you think are necessary to each of the Bands.
 * 12) Preview the Report. Only one OrdItems record related to each of the Orders record appears.

Example Resolution
Set the InitialSelectedAlias of the report data environment to Orders.

Keywords: kbprb KB136674

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.