Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Leonard Trevor
  Where is Leonard Trevor?
 Edinburgh
 United Kingdom
 Leonard Trevor
Subject: RE: adding the ouputs of 2 cursors
Thread ID: 158544 Message ID: 158604 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Tuesday, January 29, 2008 1:18:21 PM         
   



> Dear Expert,
>
> I'm combining the outputs of 2 cursors into a single cursor to generate a report cursor.
>
> How do i proceed?


Assuming that these two cursors are identical (but holding different data), you can use APPEND FROM to pull the data into a third cursor:

SELECT ... FROM MyTable1 WHERE ... INTO CURSOR MyCursor1 NOFILTER 
SELECT ... FROM MyTable2 WHERE ... INTO CURSOR MyCursor2 NOFILTER  
*Make this cursor the same structure as your queries - it needs to be ReadWrite
CREATE CURSOR MyReportCursor (F1 I, F2 C(20), ...) 
APPEND FROM DBF("MyCursor1")
APPEND FROM DBF("MyCursor2")


In VFP 9 it gets a lot easier to do this

SELECT ... FROM MyTable1 WHERE ... INTO CURSOR MyCursor NOFILTER  
SELECT ... FROM MyTable2 WHERE ... INTO CURSOR MyReportCursor READWRITE
APPEND FROM DBF("MyCursor")


Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

adding the ouputs of 2 cursors Posted by Leonard Trevor @ 1/29/2008 5:40:44 AM
RE: adding the ouputs of 2 cursors Posted by Jeremy Climaco @ 1/29/2008 6:07:23 AM
RE: adding the ouputs of 2 cursors Posted by mike castillo @ 1/29/2008 11:51:56 AM
RE: adding the ouputs of 2 cursors Posted by Andy Kramek @ 1/29/2008 12:48:54 PM
RE: adding the ouputs of 2 cursors Posted by Ken Murphy @ 1/29/2008 1:18:21 PM