>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