PRIMARY( ) Function

Example   See Also

Returns true (.T.) if an index tag is a primary index tag; otherwise, returns false (.F.).

Syntax

PRIMARY([nIndexNumber] [, nWorkArea | cTableAlias])

Returns

Logical

Arguments

nIndexNumber

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.

  1. 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.

  2. 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.).

nWorkArea

Specifies the work area of the index tag specified with nIndexNumber.

cTableAlias

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.