Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up search - Locate For or Seek?
Message
 
 
To
26/07/2000 10:50:58
Erin Eby
Mission Critical Software
Gainesville, Florida, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00397065
Message ID:
00397254
Views:
13
>Hi there! I am a reletively new FoxPro user and I had a question concerning searching a table. I am currently using Locate for's to search for my results, but I have been told that seek is quite faster. Is there something faster than seek? And can anyone explain in a nutshell what makes one faster than the other? Also, I already have a ton of indexes on the table too. Thanks for any answers you all can give me! :)

I don't have time to read all the replies to this thread, so I apologize in advance if someone already gave this tip.

Once you find an initial match with seek where there are multiple possible records matching. You can the use LOCATE to search for a secondary criteria.

SET ORDER TO SomeValuesIndexTag
SEEK Somevalue
LOCATE FOR Field2 = anothervalue WHILE OrderedField = SomeValue

Yes you can use the FOR and WHILE clause in the LOCATE. What happens is only the records matching the initial SEEK value are searched for the Field2 value. So if you have 10 records that matched the first SomeValue, only the next 10 records are searched in the LOCATE. Can't get faster than that.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform