KeyMatch()
This function lets you check whether a particular key value already exists in an index. It's sort of a manual way to do what primary and candidate indexes do automatically. KEYMATCH() was one of the functions added for dBASE compatibility in FoxPro 2.6 that's actually somewhat useful. Usage | lIsItThere = KEYMATCH( uKeyValue [, nWhichKey [, nWorkArea | cAlias ] ] ) |
Parameter | Value | Meaning |
uKeyValue | Expression | The value to check for. |
nWhichKey | Numeric | The index to check. See CANDIDATE() for an explanation of index numbers. |
nWorkArea | Numeric | Check the key for the table open in the specified work area. |
Omitted | If cAlias is also omitted, check in the table open in the current work area. | |
cAlias | Character | Check the key for the table open with the specified alias. |
Omitted | If nWorkArea is also omitted, check in the table open in the current work area. | |
lIsItThere | .T. | A record exists with the specified key value for the specified index. |
.F. | No record has the specified key value for the specified index. |
Example | USE Employee ORDER Last_Name ? KEYMATCH("KING") && Returns .T. ? KEYMATCH(" 10", TAGNO("Employee_I")) && Returns .T. SET ORDER TO ? KEYMATCH("KING", 2) && Returns .T. ? KEYMATCH("GATES", 2) && Returns .F. |
See Also | Candidate(), IndexSeek(), Locate, LookUp(), Seek, Seek(), TagNo() |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.