Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CrossTab problem
Message
De
11/11/1999 21:51:15
 
 
À
11/11/1999 20:45:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00290235
Message ID:
00290450
Vues:
28
>>>>Is there any report driver or format to print out a crosstab with a variable number of columns and variable number of rows? I also need to be able to print two columns of data (count and amount) for each column. I can generate the data for the report using a couple of views, but can't figure out how to print it. I am using VFP 6. I tried the Pivot Table, but that was too flaky (crashed repeatedly at different points and locked my Win98 system). Any suggestions???
>>>
>>>You can always transform the final cursor to some uniformed way using ALTER TABLE command to ADD/DROP/RENAME columns so report form will handle any number/name of fields.
>>
>>
>>Unfortunately, I have no idea of what you are speaking. Could you please give me an example? My table looks like this:
>>
>> Group
>>Category
>> A A B B C C D D E E ... Totals % %
>>1 amt count amt count amt count amt count amt count amt count a c
>>2 amt count amt count amt count amt count amt count amt count a c
>>3 amt count amt count amt count amt count amt count amt count a c
>>4 amt count amt count amt count amt count amt count amt count a c
>>5 amt count amt count amt count amt count amt count amt count a c
>>.
>>.
>>.
>>
>>Total amt count amt count amt count amt count amt count amt count
>>
>>There are 1 to 30 categories and A to ZZ Groups. Each "cell" contains an amount and a count of the records adding up to the amount. Of course, I need to total the columns and the rows. I also need to add the % each row contributes to the total. I hope this helps you to understand my problem a little more.
>>
>>Scott
>
>Let say, cross-tab query gave you a cursor with 5 fields: expA,expB,expT etc.
>Now, it's up to you to rename fields so they will be recognized by REPORT FORM, e.g.
>ALTER TABLE mycursor Rename column expA to Field1
>i.e. whatever the names you can always rename them to Field1,Field2... and use them in report form common to all cross-tab queries.
>You can also add more fields to the cursor using ALTER TABLE ... ADD COLUMN. New fields may be used to host calculation results, i.e. you create fields, SCAN the cursor and fill calculated values by REPLACE. Row and simple column calculations can be done by REPORT FORM itself. Also, cross-tab query itself allows to get some totals, see description in Vfpxtab.Prg file.


It works!!! But, of course, you knew that. I had to use a bunch of EVALUATE functions to get the cell data and some string and lookup functions to get the headings, but I believe it will work. I still have to add the row and column totals and the row % and I know that will force me to put in an IIF function on every variable and field, but I think I'm okay.

Thanks
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform