Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cross Tab Reports?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00002310
Message ID:
00002657
Vues:
45
Steve, I removed all formatting for the email. Hope it dosn't
look too bad.

* Create a table for listing the periods to be cross tabulated
*)(In this case months.)
DIMENSION laFields[2,4]
laFields[1,1] = "nMonth"
laFields[1,2] = "N"
laFields[1,3] = 2
laFields[1,4] = 0

laFields[2,1] = "cMonth"
laFields[2,2] = "C"
laFields[2,3] = 10
laFields[2,4] = 0

CREATE TABLE period FROM ARRAY laFields


FOR lnMonth = 1 TO 12
INSERT ;
INTO period ;
(nMonth,cMonth) ;
VALUES ;
(lnMonth, CMONTH(CTOD(STR(lnMonth)+"/01/96")) )
ENDFOR


* Create a table (cursor) with one record for each customer month
*)combination.
SELECT a.Customer_id, c.nMonth, ;
b.Unit_price * b.Quantity) AS NetOrder ;
FROM \vfp\samples\mainsamp\data\tastrade!orders a, ;
\vfp\samples\mainsamp\data\tastrade!order_line_items b ,;
period c ;
WHERE YEAR(a.Order_date) = 1994 AND ;
MONTH(a.Order_date) = nMonth AND ;
a.Order_id = b.Order_id ;
GROUP BY a.Customer_id, c.nMonth ;
INTO CURSOR CustMonthly

DO \VFP\vfpxtab WITH "sales",.F.,.F.,.T.,1,2,3,.T.
* END OF SAMPLE
Chris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform