Compartir a través de


ORDER( ) Function

Returns the name of the controlling index file or tag for the current or specified table.

ORDER([nWorkArea | cTableAlias [, nPath]])

Return Values

Character

Parameters

  • nWorkArea
    Specifies the work area of a table whose controlling index file name or controlling tag name ORDER( ) returns.
  • cTableAlias
    Specifies a table alias whose controlling index file name or controlling tag name ORDER( ) returns.
  • nPath
    Specifies that the drive and directory are returned along with the single-entry or compound index file name. The numeric expression nPath can have any value.

Remarks

A table can have several index files open simultaneously. However, only one single-entry index file (the controlling index file) or tag from a compound index file (the controlling tag) controls the order in which the table is displayed or accessed. Certain commands, such as SEEK, use the controlling index file or controlling tag to search for records. This function returns the name of the controlling index file or controlling tag.

USE and SET INDEX both support opening more than one index with an index file list. A controlling index file or controlling tag can be designated in this index file list. SET ORDER can also be used to designate a controlling index or controlling tag.

By default, ORDER( ) returns the controlling index file name or controlling tag name for the current work area. ORDER( ) returns the empty string if an order has not been set (SET ORDER TO is issued or there is no controlling index file or tag).

Example

The following example displays index tags and files.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer ORDER cust_id && Opens Customer table
? ORDER( )  && Displays CUST_ID
? ORDER('customer', 1)  && Displays CUSTOMER.CDX

See Also

INDEX | SET INDEX | SET ORDER | USE