Question : I have 9 Cursore need to make one report

OK, so I have 9 different selects making up 9 different cursors.

All I need to do is take the User and SoucreCode  fields from each cursor and make one that is group by user and the sum() of the codes.

and make it one Cursor...for reports/excel

joining them in some way...???

cXEShip
cXeRecv
cStage
cTruck
cWillCall
cMoves
cCut
cConsolidate
cPO

iruser, irsource

results in attachment...

Answer : I have 9 Cursore need to make one report

A very simplistic approach would be as follows:

* --- Create Receptacle   for Report Data ---
CREATE TABLE FREE c:\temp\RptDBF.dbf;
  (IRUser C(30),;
   IRSource C(30)

FOR CursCntr = 1 TO 9
  cThisCursor = "Cursor" + STR(CursCntr,1) *
 
 * --- Get Individual usernames and sources from individual cursors ---
 SELECT Distinct iRUser, IRSource FROM (cThisCursor) INTO CURSOR ThisData

 * --- Populate Report table from individual cursors ---
 SELECT RptDBF
 APPEND FROM DBF('ThisData')

 SELECT ThisData
 USE
ENDFOR

SELECT RptDBF
COPY TO c:\temp\NewExcel.xls XL5
USE


However you might want to consider why you are needing to get 9 separate Cursors in the first place.   Perhaps that code could be modified to make things easier.

Good Luck




Random Solutions  
 
programming4us programming4us