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_keyadd() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_KeyAdd()
 Manually add a key to an index or tag
------------------------------------------------------------------------------

 Syntax

     AX_KeyAdd( [<cOrder>|<nPosition>], [<cCDXName>] ) -> logical

     <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> Assumed to be the number representing the position
     of an order in the active index file or specified index file (in
     <cCDXName>). If not a valid order position within the active or
     selected index file, then is assumed to be an index file order. 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 logical .T. if the key was successfully added or .F. if an
     error occurred.  If an error occurred, AX_Error() will return
     information on why the function failed.

 Description

     This function is used to manually add a key to an index. This
     function can be used while managing custom indexes created with
     the CUSTOM clause during the INDEX creation. When used in
     conjunction with AX_KeyDrop(), you can easily manage your own
     customized indexes.

     Note: This function is supported only with the DBFCDXAX (.cdx)
     driver.

     Note: The record must be locked or the table opened exclusively
     or locked before performing this operation.

     If you are currently using a logical field in your table to
     indicate if a record should be included in a process (i.e., a report),
     you might have a hot-key set up in your browse that your user presses
     to toggle that record between TRUE and FALSE. Instead of taking up
     one byte for each record in your table, you can use a custom index.
     When the hot-key is pressed, you just AX_KeyAdd() that record into
     the custom index.

 Example

     // Need to include Advantage header file for INDEX ON ... CUSTOM
     #include "DBFCDXAX.CH"

     USE test VIA "DBFCDXAX"        // Open table
     INDEX ON last TO last CUSTOM   // Create CUSTOM index file
     GOTO 10                        // Select a record

     RLock()                        // The record must be locked before
                                    // adding a key
     AX_KeyAdd()                    // Add a key for this record
     ? AX_KeyCount()                // Display number of keys in index


See Also: AX_KeyDrop() INDEX

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