Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jamie Osborn
  Where is Jamie Osborn?
 Melbourne
 Australia
 Jamie Osborn
 To: leigh p
  Where is leigh p?
 
 California - United States
 leigh p
 Tags
Subject: RE: Multi-Cursor Report Output
Thread ID: 33996 Message ID: 34027 # Views: 2 # Ratings: 0
Version: Visual FoxPro 7 Category: Reports and Printers
Date: Saturday, December 06, 2003 10:14:20 PM         
   


> > > Hi All! I am in need of some assistance.
> > >
> > > I have 2 cursors - #1 = _rptQuery (parent) #2 = _rptQuery2 (child)
> > > These cursors have a one to many relationship. The key is record_id
> > >
> > > I want to output all records in the parent (_rptQuery) and those that match from the child (_rptQuery2).
> > > The problem I'm having is the output. When there is a match in the child table, it is printing 1 parent record for each child record... like this
> > >
> > > 00001 parent loan record - detail..................
> > > child record - detail.......
> > > 00001 parent loan record - detail...................
> > > child record - detail......
> > > 00001 parent loan record - detail...................
> > > child record - detail......
> > >
> > > I need it to print just one parent record followed by all child records in succession.
> > > I thought the problem my be when I set the relation into the 2 cursors - as I'm fairly new to this.
> > > This is my code...
> > > SELECT _rptQuery2
> > > INDEX ON parent_id TAG record_id
> > > SELECT _rptquery
> > > SET RELATION TO record_id INTO _rptquery2
> > > SET SKIP TO _rptquery2
> > >
> > > or maybe this is just a report design issue. anyone?
> > >
> > > Thanks in Advance,
> > > Leigh
> > >
> > >
> >
> > The easiest thing to do is create a denormalised set of results in one cursor and use that for the report. Why bother with relations etc ?
>
> A denormalised set of results? I will have to look that up. :)
> Thanks! Leigh

I should have explained that better - it means that the parent table info is included in each child row.
eg. If you currently have results such as:

CUSTOMER (parent)
CUSTOMERID NAME
1 Fred Smith
2 Joe Blow

INVOICE (child)
CUSTOMERID AMOUNT
1 100.00
1 120.50
2 500.00

then the denormalised result cursor would be :
CUSTOMERID NAME AMOUNT
1 Fred Smith 100.00
1 Fred Smith 120.50
2 Joe Blow 500.00

Cheers,
Jamie
jamie.osborn@foxite.com

ENTIRE THREAD

Multi-Cursor Report Output Posted by leigh p @ 12/5/2003 8:00:43 PM
RE: Multi-Cursor Report Output Posted by Willem van Oosten @ 12/5/2003 9:34:23 PM
RE: Multi-Cursor Report Output Posted by Jamie Osborn @ 12/5/2003 9:37:09 PM
RE: Multi-Cursor Report Output Posted by leigh p @ 12/6/2003 2:31:20 AM
RE: Multi-Cursor Report Output Posted by Jamie Osborn @ 12/6/2003 10:14:20 PM