Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report with Parent/Child/Child relationship

Status
Not open for further replies.

Foxtrotter

IS-IT--Management
Jan 5, 2011
57
US
Hi, I have a report in VFP9 that involves a parent child to child relationship. Basically, it's customer/order/order detail. Because of other posts I saw in this forum, I created a cursor combining my order header and order detail information into a single cursor so that I now only have one detail band in my report. Therefore, I have one relationship set between my customer table and the new orders/details cursor with a set skip to the order/detail cursor. In my report, I have my detail band which is my actual order detail info (item#, description, qty). I have 3 data groups on a period field, and customer# both contained in the customer table and order# in the orders/details cursor. The output looks like this:

(Sorry, I could not get the indentions to show up in here, at least in preview. Each group (customer, order, details) should be indented over.)
Period: January 2007
Customer# Name City/State
123457 Bill Jones Dallas, Tx
Order# Date Total
56790 1/10/2007 $100.00
Item# Description Qty
300 Product A 1
400 Product B 1
500 Product C 1

Customer# Name City/State
123456 Tom Jones Portland, OR
Order# Date Total
56789 1/10/2007 $100.00
Item# Description Qty
300 Product A 1
400 Product B 1

Order# Date Total
56803 1/29/2007 $120.00
Item# Description Qty
500 Product C 1
600 Product D 1
Order# Date Total 56789 1/10/2007 $100.00

Customer# Name City/State
123458 Will Jones Dallas, Tx

Everything works well except when the second case happens where I have multiple orders for the same customer in the same period. For some reason, it is reprinting the order header information for the first order again although it does not reprint the detail product information. The order header information is in the group header section for order# and is set to not repeat and to remove blank lines because this same information is contained in each row of the order detail cursor. The group on order# should trigger the new order to print which it does but something is triggering it to start over again when it moves to the next customer. It's like when the group on customer# is triggered, it triggers the group on order# first causing it to fire.

Any ideas on how to prevent this?

 
You havent created a single report cursor, you still have two. Your problem seems to be related to the set skip, although that should work, but what is the report driving cursor? What is selected, whhn you REPORT FORM...? It should be the parent data alias.

You may also fully go the route of driving the report with one cursor only, and join all data into one report cursor, including the customer head data.

Bye, Olaf.

 
The customer table is the driving cursor and is selected when calling the report. You might be right about driving it with a single cursor. I think I will investigate that option.

Thanks.
 
Olaf,

It appears that creating a single driving cursor works for me. Thanks for the suggestion.

Mike, I did not try the code tags but did use the indent button here in the editor. It used the "indent/indent" tags but apparently that doesn't seem to work. It just removes the tags.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top