| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Removes an index key from a custom built index.
OrdKeyDel( [<nOrder>|<cIndexName>], ;
[<cIndexFile>] , ;
[<xIndexValue>] ) --> lSuccess
The function returns .T. (true) if the current record is successfully removed from the index, otherwise .F. (false) is returned.
OrdKeyDel() is used in conjunction with OrdKeyAdd() to maintain a custom built index programmatically. Custom built indexes are not automatically updated by the RDD but are initially empty. OrdKeyDel() removes the current record from a custom index, if it is included in the specified index.
If no parameters are passed, OrdKeyDel() evaluates the index expresssion with the data of the current record to obtain <xIndexValue>. The record is removed from the index when it is found.
OrdKeyDel() fails if the record pointer is positioned on Eof(), if the specified index is not a custom index, if the specified index does not exist, or if the current record is not included in the custom index.
| See also: | DbOrderInfo(), DbGoto(), INDEX, OrdKey(), OrdKeyAdd(), OrdKeyVal() |
| Category: | Database functions , Index functions |
| Source: | rdd\dbcmd.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example creates a regular and a custom index holding five
// index keys. The last index key is removed from the custom index.
REQUEST Dbfcdx
PROCEDURE Main
USE Customer VIA "DBFCDX"
INDEX ON Upper(LastName) TAG NAME TO Cust01
INDEX ON Upper(LastName) TAG NAMESET TO Cust01 CUSTOM
OrdSetFocus( "NAME" )
GO BOTTOM
? OrdKeyVal() // result: WATERS
GO TOP
FOR i:=1 TO 5
OrdKeyAdd( "NAMESET" )
SKIP
NEXT
OrdSetFocus( "NAMESET" )
GO BOTTOM
? OrdKeyVal() // result: CHAUCER
? OrdKeyDel( "NAMESET" )
? OrdKeyVal() // result: NIL
USE
RETURN
http://www.xHarbour.com