Set Key, Set("Key")
This command is a good alternative to setting a filter when you want to narrow down the visible records based on the current index. It lets you specify an index key or range of keys to be filtered in.
Usage |
SET KEY TO [ uKeyValue ] [ IN cAlias | nWorkArea ] SET KEY TO RANGE uLowKey, uHighKey | RANGE uLowKey, | RANGE , uHighKey [ IN cAlias | nWorkArea ] cKeyValues = SET( "KEY" ) cLowKey = SET( "KEY", 1) cHighKey = SET( "KEY", 2) |
VFP 7 Service Pack 1 fixes two bugs that were introduced in VFP 7. The first bug was that SEEK(), INDEXSEEK() and LOOKUP() would find records that were outside the scope of SET KEY. The second bug was pretty obscure: If the key length for the index used by SET KEY was exactly 240 characters, not all records that should have been in scope were. |
Example |
USE Customer SET ORDER TO Company_Na * limit to customers beginning with "G" SET KEY TO "G" ? SET("KEY") && Returns "G, G" ? SET("KEY",1) && Returns "G" ? SET("KEY",2) && Returns "G" * limit to customers between "Fo" and "Fu" SET KEY TO RANGE "Fo","Fu" ? SET("KEY") && Returns "Fo, Fu" ? SET("KEY",1) && Returns "Fo" ? SET("KEY",2) && Returns "Fu" * limit to customers up to "K" SET KEY TO RANGE , "K" ? SET("KEY") && Returns ",K" ? SET("KEY",1) && Returns " " ? SET("KEY",2) && Returns "K" * make all customers visible SET KEY TO |
See Also |