Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Efficient counting of recs with duplicate key fields
Message
De
13/06/1999 19:54:04
 
 
À
13/06/1999 13:01:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00229225
Message ID:
00229304
Vues:
16
>SEEK vVal TAG KeyTagName
>COUNT TO nDupes WHILE keyfield = vVal
>
>This doesn't mess up your index order, is optimizable (well, that depends on your key expression), and should be faster as it doesn't create a cursor.
>

If you mean that a completely different tag order is active, I'm not sure why the above works, since records having keyname=vVal would not necessarily be >contiguous< with respect to the ordering by another key, and the WHILE would fail before all dups are encountered.

If the above really does work when ordered by a completely different key I'd have to say that the WHILE clause is a little counterintuitive. Substituting FOR for WHILE fixes it, I think?!

What I was really trying to figure out is whether "searching by filtering" buys you anything or hurts you if you have a big file. The following:

SET FILTER TO keyfield=vVAL
COUNT ALL

seems pretty sexy to me, but I'm aware that underlying implementation can sometimes take all the fun out of 'clever' solutions! That's why I asked the question in the first place.
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform