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_killtag() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_KillTag()
 Delete a tag from a compound index (.cdx)
------------------------------------------------------------------------------

 Syntax

     AX_KillTag( <cTagName>|<lAll> [, cCDXName] ) -> logical

     <cTagName> A character string of the name of the tag to delete.

     <lAll> A logical value .T. indicating delete all tags in the .cdx.

     <cCDXName>  A character string of the name of the .cdx file from
     which to delete the specified tag(s).

     Note:  The AX_KillTag() function works only with .cdx files.  The
     function has no effect on .idx or .ntx files.

 Returns

     Returns a logical .T. if the tag is deleted.  If an error occurred or
     the tag does not exist, a .F. is returned.

 Description

     AX_KillTag() deletes one or all tags from the currently active or
     specified compound index file (.cdx).  If <cCDXName> is specified,
     only that .cdx file is searched for the tag name.  Otherwise, the
     active .cdx files are searched in the order they were opened.  If the
     specified tag is the only tag in the .cdx file, then the tag and the
     .cdx file are both automatically deleted.

     If <lAll> (logical .T.) is passed as the first argument, the .cdx file
     is deleted.  If <cCDXName> is not specified, the current .cdx file is
     deleted.

     Files must be opened in EXCLUSIVE mode in order to delete a tag(s).

     Note: AX_KillTag() is illegal if performed within a transaction.
     If AX_KillTag() is called while within a transaction, a runtime error
     will occur.

 Example

     LOCAL aTags, nCnt

     USE test INDEX test VIA "DBFCDXAX"      // Open TEST.DBF and TEST.CDX

     // Create a few tags. The first also creates TEMPCDX.CDX
     INDEX ON last TAG temp1 TO tempcdx
     INDEX ON first TAG temp2 TO tempcdx
     INDEX ON last + first TAG temp3 TO tempcdx

     // Show the tag names
     ? AX_IndexName() + " has the following tags:"
     aTags := AX_Tags()

     FOR nCnt := 1 TO LEN( aTags )
          ? aTags[nCnt]                   // temp1, temp2, temp3
     NEXT

     // Delete the second tag
     ? "Deleting a tag..."
     AX_KillTag( "TEMP2", "TEMPCDX" )

     // Now show the tags names again
     ? AX_IndexName() + " now has the following tags:"
     aTags := AX_Tags()

     FOR nCnt := 1 TO LEN( aTags )
        ? aTags[nCnt]                     // temp1, temp3
     NEXT

     // Kill off the temp .CDX
     ? "Killing off " + AX_IndexName()
     AX_KillTag( .T. )


See Also: DELETE TAG AX_Tags() AX_IndexName()

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