Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Description Sequence...
Message
 
 
À
06/08/2001 10:36:25
N. Lea
Nic Cross Enterprises
Valencia, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00540161
Message ID:
00540338
Vues:
15
What is relationship between Report1 and Reportnames? Is the summary description in Reportnames for each printorder or for each report? What is a primary key in the Report1 and Reportnames?

>I need some help with this code in trying to determine why the system will not take more than the first description record from the table. What it is supposed to be doing is inputing data from 2 tables into a cursor. A majority of the data comes from a table called Report1 while the description comes from a table called reportnames. All reportnames has is the summary description and the printorder number. However, whenever brought over, the only description issued is the repeated first item in the table. For instance:
>
>the first record in the table reportnames is: Gross Mold Income.
>
>When brought into the cursor:
>
>GROSS MOLD INCOME 10
>GROSS MOLD INCOME 20
>GROSS MOLD INCOME 30
>GROSS MOLD INCOME 40
>
>I have tried changing the process numerous times, but keep on getting stuck. I have changed the table structure to match exactly, but no luck. Any suggestions? The code is below:
>
>WITH THIS
>	.mTableOpen('report1','printorder')
>	.mTableOpen('report1','printorder',.F.,'a_report1',.F.)
>	.mTableOpen('reportnames','printorder')
>	.mTableOpen('gl_acct','report_1')
>	
>	**-- PRE-SQL-SELECT-STATEMENT: Creates the 3 cursors to be used --**
>	CREATE CURSOR OriginalTable ;
>		(report_1 C(3), descript C(35), total N(12,2), printorder N(3), groupcode c(3), I_L C(1))
>		
>	CREATE CURSOR SummaryTable ;
>		(report_1 C(3), descript C(35), total N(12,2), printorder N(3), groupcode c(3), I_L C(1))
>	
>	CREATE CURSOR DisplayTable ;
>		(report_1 C(3), descript C(35), total N(12,2), printorder N(3),groupcode c(3), I_L C(1))
>	**-- END OF PRE-SQL-SELECT-STATEMENT --**
>	
>	**-- SECTION 1: Copies all table data from report1 into a cursor called OriginalTable --**
>	SELECT report1
>	COPY ALL TO ARRAY gaTempOriginal
>	
>	SELECT OriginalTable
>	APPEND FROM ARRAY gaTempOriginal
>
>	**-- END OF SECTION 1: final completion of copy from original database. --*
>	
>	**-- SECTION 2: Copies and calculates all data into a cursor --**
>	SELECT 'X' AS report_1, ;
>		   reportnames.descript AS descript,  ;
>	         ROUND(SUM(IIF(groupcode = groupcode AND !EMPTY(I_L),total, 0)),2) AS Total,  ;
>   		   printorder AS printorder,  ;
>    		   groupcode AS groupcode, ;
>    		   "X" AS I_L ;
>   	FROM Report1 ;
>   	GROUP BY Groupcode ;
>   	ORDER BY I_L ;
>    	INTO CURSOR SummaryTable
>    	COPY ALL TO ARRAY gaTempCursor
>    **-- END OF SECTION 2: final completion of summary calculations --**
>    BROW  	
>
>	**-- SECTION 3: Union joins the two SQL-SELECT statements above for grid display --**
>	SELECT DisplayTable
>	APPEND FROM ARRAY gaTempCursor
>	APPEND FROM ARRAY gaTempOriginal
>	INDEX ON groupcode + I_L to overall
>	
>	**-- END OF SECTION 3: final completion of UNION JOIN --**
>	BROW
>	
>ENDWITH
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform