Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Newbie Question
Message
De
28/02/2006 21:33:03
 
 
À
28/02/2006 16:32:04
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Divers
Thread ID:
01100105
Message ID:
01100245
Vues:
16
You've learned a lot of tricks in the Microsoft public newsgroups.

>>I need to create a query that will provide 12 months of data that can be dropped into a spreadsheet via _vfp.dataclip(,,3) function. The results should look something like:
>>
>> JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
>>ITEM1 12 13 9 12 6 21 13 15 12 16 9 12
>
>Hi Robert,
>
>Have you considered compiling your data the usual way (Month, Item, Value) and then using automation to create a pivot table? Here's some code I use:
>loBook = This.oExcel.ActiveWorkbook
>
>*-- Data pasted into sheet "Raw Data"
>*-- Select all the data
>loFirstCell = This.oExcel.Sheets("Raw Data").Cells(This.nFirstDataRow - 3, 1)
>loLastCell = loFirstCell.SpecialCells(11) 	&& xlLastCell
>loSourceData = loBook.Sheets("Raw Data").Range(loFirstCell, loLastCell)
>
>*-- Pivot table location
>loDestination = loBook.Sheets("Profit Loss By Division").Range("A9")
>
>*-- Make the pivot
>loPivotTable = loBook.Sheets("Raw Data").PivotTableWizard( ;
>    1, loSourceData, loDestination, "Summary of Physician P&Ls", .T., .T.)
>loPivotTable.AddFields("Division Name")
>loPivotTable.PivotFields("FYTD " + Left(This.cThisQuarter, 2)).Orientation = 4 && xlDataField
>loPivotTable.DataFields(1).Function = -4157 && xlSum
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform