Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Permuting a query N times
Message
De
29/11/2007 11:40:18
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
28/11/2007 23:44:47
Luis Navas
Independent Consultant
Auckland, Nouvelle Zélande
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01271938
Message ID:
01272104
Vues:
22
>Hi to all, I have a tricky one (at least for me), I need to create a recursive query of the same table, let me explain a little more:
>
>
>I have a table with these fields as structure and some sample data:
>Category___Manufacturer____Brand________Weight_____Characteristic1_Char2___Char3______Char4_______Char5
>Cereals_______Kellogs_________Corn Flakes__300 Gr_____Box_____________Natural_Corn_______No Def______No Def
>Sodas_________Coca Cola Comp__Coca Cola____2000 Ml____Glass___________Cola____Light______No Def______No Def
>Female Prot___Kimberly Klark__Kotex________12 Units___With Wings______Thin____with smell_Good Nights_No Def
>
>The fields characteristic 1 to 5 could be different attributes for each category, like type of package, flavor, model, etc.
>
>I have another table, with a field Character(6) that holds the order of the way that the user needs to see the information, I use six because Category, Manufacturer and Brand use the same order 0,1,2 respective.
>The users decides the order of the other parts 0 for Weight, 1 for characteristic 1, 2 for characteristic 2 and so on.

You can have a moverbox, with list of fields on the left, and sorting fields on the right. Then the user would pick six fields from the left, and arrange them on the right. Then when the user clicks OK, you'd build an Order By clause from the right side list, and then either insert it into your SQL statement as a macro, or build the whole SQL statement as a script and run it via execscript() - your choice. The resulting cursor would be in the order user wanted.

Or you can have data selected already in any order in crsTemp, and have a cursor for your grid, then
zap in gridCursor
insert into gridCursor ;
   select * from crsTemp ;
   order by &lcOrder
assuming VFP8 or 9 (not sure insert into works in 7 or earlier, but then you can append from dbf("crsTemp") instead).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform