Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Crosstab sorting question
Message
De
16/08/2007 19:04:41
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01248074
Message ID:
01248701
Vues:
30
Hi Sergey:

Maybe I didn't make myself clear.

Run the follwing program and tell me how to sort by birth date so that the order of the columns is cust3, cust2, cust1.
CLOSE all

CREATE CURSOR PreXtab (row C(10), col C(10), data C(10))

INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Shoe Size', 'cust1', '8')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Birth Date', 'cust1', '1/1/90')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('cat name', 'cust1', 'sue')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Shoe Size', 'cust2', '9')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Birth Date', 'cust2', '1/1/89')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('cat name', 'cust2', 'alex')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Shoe Size', 'cust3', '11')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Birth Date', 'cust3', '1/1/88')
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('cat name', 'cust3', 'ruffles')
				
* 		 Parm1 - output file/cursor name (default "xtab.dbf")
* 		 Parm2 - cursor only (default .F.)
* 		 Parm3 - close input table after (default .T.)
* 		 Parm4 - show thermometer (default .T.)
* 		 Parm5 - row field 	(default 1)
* 		 Parm6 - column field 	(default 2)
* 		 Parm7 - data field 	(default 3)
* 		 Parm8 - total rows	(default .F.)
* 		 Parm9 - totaling options (0-sum, 1-count, 2-% of total)
* 		 Parm10 - display Null values
DO HOME() + "VFPXTab" WITH "RawXTab",.T.,.F.,.T.,1,2,3,.F.,0,.T.
My solution is to prepend the birthdate to the column field like so:
INSERT INTO PreXtab (row, col, data)   ;
VALUES ('Shoe Size', '19900101cust1', '8')
and then in the report construct the column header like so:
substr(field(1),9)
Thanks for responding,

Yossi

>Mabe I'm missing something but can you make that row the first row?
>
>>I'm running a cross tab:
>>
>>
>>DO HOME() + "VFPXTab" WITH "RawXTab",.T.,.F.,.T.,2,1,3,.F.,0,.T.
>>
>>
>>but I can't figure out how to get the columns sorted according to the data in one of the resulting rows. The system automatically sorts the columns based on the data in the forst row.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform