Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Advantage CA-Clipper Guide v6.11 - ax_keyno() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_KeyNo()
 Get position of current key within index or tag
------------------------------------------------------------------------------

 Syntax

     AX_KeyNo( [<cOrder>]|[<nPosition>], [<cCDXName>] ) -> numeric

     <cOrder>  is a literal filename or character string specifying
     the name of the order. Using the order name is the preferred
     method since the position may be difficult to determine using
     multiple-order index files. If omitted or NIL, the controlling
     order is assumed.

     <nPosition>  is the number representing the position of an
     order in the order list. If omitted or NIL, the controlling
     order is assumed.

     <cCDXName>  is a literal filename or character string
     specifying the name of an index file, including an optional
     drive and directory (no extension should be specified). Use
     this argument with <cOrder> to remove ambiguity when there are
     two or more orders with the same name in different index files.

 Returns

     Returns a numeric value indicating the logical location of the
     current key in the current or specified index.

 Description

     This function examines the current index and returns the logical
     record position of the current key in the current or specified index
     or tag. If the current or specified index is a compound index (.cdx)
     then the active tag is used.

     This function allows you to determine the depth of the current index
     key in an index or tag, regardless of whether the index is conditional
     or not.

     This function respects any active index SCOPE and will return the
     relative key position within the active scope condition.

     Keep in mind that this function determines its return value strictly
     based on KEYS in the index file. If you have marked records in your
     table for deletion, the index KEY for those records will STILL be
     in the index, and will STILL be counted. If you do not want AX_KeyNo()
     or AX_KeyCount() to count keys for records marked as deleted, you must
     create the index as a CONDITIONAL index FOR !DELETED(). For example:

            INDEX ON last TAG last FOR !Deleted()

     Note:  This function will literally count many or all keys in an
     index.  So, if you are working with extremely large indexes, this
     function may take a few seconds to complete.  Use of this function may
     also lead to poor multi-user performance as the index remains locked
     throughout the entire operation, which means other users cannot write
     to or read from that index until the Key No operation is complete.

     Note: This function does not work with non-compact IDX indexes.

 Example

     // Assuming that TEST.PRG has 1000 records
     USE test VIA "DBFCDXAX"        // Open TEST.DBF
     INDEX ON last TAG last         // Create LAST tag

     GO TOP                         // Go to the top of the index
     ? RecNo()                      // Display record number (who knows?)
     ? AX_KeyNo()                   // Display key number (1)

     GO BOTTOM                      // Go to the top of the index
     ? RecNo()                      // Display record number (who knows?)
     ? AX_KeyNo()                   // Display key number (1000)


See Also: AX_KeyCount()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson