Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LOCATING backwards
Message
From
27/10/2003 05:16:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/10/2003 14:15:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00842157
Message ID:
00842831
Views:
23
>>>>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.)

First rather than 3rd :)
I don't want to heat the waters again but you could simply have an index with a constant key just for things like this.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform