Returns true (.T.) if an index tag is a primary index tag; otherwise, returns false (.F.).
PRIMARY([nIndexNumber] [, nWorkArea | cTableAlias])
- Specifies the number of the index tag for which PRIMARY(В ) returns the primary status. PRIMARY(В ) returns the primary status in the following order as nIndexNumber increases from 1 to the total number of structural compound and independent compound index tags.
Primary status for each tag in the structural compound index (if one is present) are returned first. The primary status is returned for the tags in the order the tags are created in the structural index.
Primary status for each tag in any open, independent compound indexes are returned next. The primary status is returned for the tags in the order in which the tags are created in the independent compound indexes.
If you omit nIndexNumber, PRIMARY(В ) checks the master controlling index tag to see if it's a primary index tag. If there is no master controlling index tag, PRIMARY(В ) returns false (.F.).
- Specifies the work area of the index tag specified with nIndexNumber.
- Specifies the work area of the index tag specified with nIndexNumber. If you omit nWorkArea and cTableAlias, PRIMARY(В ) checks the index tag in the currently selected work area to see if it's a primary index tag.
The following example opens the
customer table in the database. FOR ... ENDFOR is used to create a loop in which the primary status of each index tag in the
customer structural index is checked. The name of each structural index tag is displayed with its primary status.
CLOSE DATABASES SET PATH TO (HOME(2) + 'Data\') && Sets path to database OPEN DATABASE testdata && Open testdata database USE Customer && Open customer table FOR nCount = 1 TO TAGCOUNT( ) IF !EMPTY(TAG(nCount)) && Checks for tags in the index ? TAG(nCount) && Display tag name ? PRIMARY(nCount) && Display primary status ELSE EXIT && Exit the loop when no more tags are found ENDIF ENDFOR