Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LOCATING backwards
Message
De
26/10/2003 11:47:50
 
 
À
25/10/2003 14:15:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00842157
Message ID:
00842733
Vues:
27
>>>>can you use the locate cmd to start at end of a dbf and proceed backwards?
>>>
>>>You might simply skip -1 in a DO WHILE loop, until you find the record (or BOF, or the equivalent of a WHILE condition). Pressumably, this would be slower than a single command (which doesn't seem to exist).
>>>
>>>Since this is probably not a frequent requirement, I would evaluate each situation separately: whether it is better to use a reverse index, or write your loop.
>>
>>Hilmar, the reverse index exists for every already existing index. It is the keyword ASCE or DESC of the SET ORDER command.
>
>Yes, right, that is a third alternative, which I had briefly forgotten. Probably that is the fastest alternative, if you work with an index - which should be the general case. (How else would you define which is the "last" record? - physical order is seldom significant.)

You're directing my attention to the fact that Timothy Bowen referred to a LOCATE, probably because the table is not ordered. I have all too easy assumed an indexed order. I've just tested SET ORDER TO 0 DESC. There's no error, but the keyword DESC appears to have no effect. Pity.
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform