Function OrdName() Foundation

Returns the index name from the list of open indexes.

Syntax
OrdName( [<nIndex>] ) --> cTagName
Parameters
<nIndex>
<nIndex> is a positive integer specifying the ordinal position within a work area of the index whose index name is returned. The indexes are numbered in the order that they were activated using OrdListAdd() or SET INDEX TO.
Return

The return value of OrdName() is a character string containing the name of an index from the list of open indexes. The index name is comparable to the alias name of a work area. When no argument is passed to the function, it returns the index name of the controlling index. If no index file is open, a null string ("") is returned.

Description

The file function OrdName() returns the name of an index in a work area. When the function is used without the alias operator, it returns an index name from the current work area. The index name is specified in the command INDEX using the option TAG. It is comparable to the alias name of a work area and makes the selection of an index by a user defined name possible. An index can then be selected within a program without its position in the list of open indexes being known.

Examples
OrdName()
// In the example, two indexes for a customer file are created 
// and the return values of OrdName() are shown. 

PROCEDURE Main 
   USE Customer NEW EXCLUSIVE 

   INDEX ON CUSTNO ; 
        TAG CustNo ; 
         TO CustA 

   INDEX ON Upper(LASTNAME+FIRSTNAME) ; 
        TAG CustName ; 
         TO CustB 

   SET INDEX TO CustA, CustB 

   ? OrdNumber()               // result: 1 

   ? OrdName(0)                // result: CUSTNO 
   ? OrdName(1)                // result: CUSTNO 
   ? OrdName(2)                // result: CUSTNAME 

   CLOSE Customer 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.