TagCount(), TagNo()
He telleth the number of the stars; he calleth them all by their names.
The Book of Psalms 147:4
This pair of functions was added to FoxPro 2.6 for compatibility with dBase. Despite the short shrift they're given in the documentation, they're both fairly useful. TAGCOUNT() tells you the number of tags and stand-alone indexes open for a table, while TAGNO() identifies the position of a tag or index in the list of open indexes.
Usage |
nTotalTags = TAGCOUNT( [ cIndexFile [, nWorkArea | cAlias ] ] ) |
Parameter |
Value |
Meaning |
cIndexFile |
Character |
Name of the CDX file for which to return a tag count. |
Omitted or Empty |
Return the total open tag count for the table. |
|
nWorkArea |
Numeric |
Return information about the table open in work area nWorkArea. |
Omitted |
If cAlias is also omitted, return information about the table open in the current work area. |
|
cAlias |
Character |
Return information about the table open as cAlias. |
Omitted |
If nWorkArea is also omitted, return information about the table open in the current work area. |
There's a secret to making TAGCOUNT() useful in work areas other than the current work area. The order of parameters makes it seem that you have to inquire about a particular index file in another work area, but passing the empty string for cIndexFile causes the function to return all tag information. |
Example |
USE Employee && TasTrade employee table ? TAGCOUNT() && Returns 3 SELECT 0 && move to another work area ? TAGCOUNT("","Employee") && Returns 3 ? TAGCOUNT("Employee","Employee") && Returns 3 |
Usage |
nTagNumber = TAGNO( [ cIndexName [, cIndexFile [, nWorkArea | cAlias ] ] ] ) |
Parameter |
Value |
Meaning |
cIndexName |
Character |
Name of the stand-alone index or tag whose position is to be returned. |
Omitted |
Return the position of the current master index. |
|
cIndexFile |
Character |
Name of the CDX file about which to return information. |
Omitted |
Return the position of the current master index. |
|
nWorkArea |
Numeric |
Return information about the table open in work area nWorkArea. |
Omitted |
If cAlias is also omitted, return information about the table open in the current work area. |
|
cAlias |
Character |
Return information about the table open as cAlias. |
Omitted |
If nWorkArea is also omitted, return information about the table open in the current work area. |
Example |
USE Employee ? TAGNO("Last_Name") && Returns 2 ? TAGNO("Group_Id") && Returns 1 SELECT 0 && Go to another work area ? TAGNO("Last_Name","","Employee") && Returns 2 |
See Also |