xHarbour Reference Documentation > Function Reference |
Retrieves the total number of keys included in an index.
OrdKeyCount( [<nOrder>|<cIndexName>][,<cIndexFile>] ) --> nKeyCount
The function returns the number of keys included in the specified index. If no parameter is passed, the controlling index is used. If the specified index does not exist, a runtime error is generated.
The function counts the index keys present in the specified index. For this, it recognizes a possible FOR condition and/or scope set with OrdScope(). If no FOR condition and no scope is defined for the index, the return value of OrdKeyCount() is identical with LastRec(), which returns the physical number of records in a work area.
Scopes and FOR conditions restrict the logical visibility of records, so that OrdKeyCount() represents the number of records that can be navigated to using SKIP. This information is especially required for programming scroll bars in browse views.
See also: | DbOrderInfo(), DbGoto(), DbSkip(), LastRec(), OrdKeyGoto(), OrdKeyNo(), OrdScope() |
Category: | Database functions , Index functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example compares return values of LastRec() and OrdKeyCount() // when the logical visibility of records is unrestricted vs. restricted // with OrdScope(). #include "Ord.ch" PROCEDURE Main USE Customer INDEX ON Upper(LastName+Firstname) TAG Name TO Cust01 ? LastRec() // result: 225 ? OrdKeyCount() // result: 225 OrdScope( TOPSCOPE , "E" ) OrdScope( BOTTOMSCOPE, "G" ) ? LastRec() // result: 225 ? OrdKeyCount() // result: 13 USE RETURN
http://www.xHarbour.com