Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Different using set key to and set filter to
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00739234
Message ID:
00739765
Views:
9
If used properly, "SET KEY" will be always faster than "SET FILTER".
*--- #1 
SET KEY TO RANGE ke1, key2
SCAN
ENDSCAN
* is equivalent to
=SEEK(key1)
SCAN WHILE BETWEEN(key, key1, key2)
ENDSCAN
*--- #2
SETFILTER TO BETWEEN(key, key1, key2)
SCAN
ENDSCAN
* is equivalent to
SCAN FOR BETWEEN(key, key1, key2)
ENDSCAN
The #1 will neverbe slower than #2.

>The Online Help explains it very well but I would summarize the difference in 'Set Key' command has to have a tag/order set on the expression, 'Set Filter' doesn't. You will find that 'Set Filter to' expression is faster when the expression is optimized.
>
>I think most developers prefer for 'Set Filter' command because of its flexibility.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform