Function OrdNumber() Foundation

Returns the position of an index in the index list based on the index name.

Syntax
OrdNumber( [<cTagName>] ) --> nIndexOrder
Parameters
<cTagName>
<cTagName> is a character string specifying the name of an index whose ordinal position in the index list is returned. <cTagName>is comparable to the alias name of a work area.
Return

The return value of OrdNumber() is a positive integer indicating the position of an index in the list of open indexes. The indexes are numbered in the order that they were activated using OrdListAdd() or SET INDEX TO. When no index is open, the function returns the value zero. When no value is specified for <cTagName>, the position of the controlling index is returned.

Description

The index function OrdNumber() determines the position of an index in the list of open indexes in a work area. When the function is used without the alias operator, it returns the position of an index in the current work area. The ordinal position of the index depends on the order that the indexes were activated using OrdListAdd() or SET INDEX TO. The return value of OrdNumber() is the same as the return value of the function IndexOrd(), but IndexOrd() only determines the position of the controlling index.

OrdNumber() is comparable to the function Select(), which returns the ordinal number of a work area based on its alias name.

Examples
OrdNumber()
// In the example, two indexes are created for a customer file 
// and the return values of OrdNumber() 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 

   ? OrdNumber("CustNo")         // result: 1 
   ? OrdNumber("CustName")       // result: 2 

   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.