$FUNCNAME$
  INDEXORD()
$CATEGORY$
  DATABASE
$SUMMARY$
   Return the order position of the controlling index
$LANG_RU$
       .
$SYNTAX$
     INDEXORD() --> nOrder
$LANG_RU$
     INDEXORD() -->  
$RETURNS$
     INDEXORD() returns an integer numeric value.  The value returned is
     equal to the position of the controlling index in the list of open
     indexes for the current work area.  A value of zero indicates that there
     is no controlling index and records are being accessed in natural order.
     If no database file is open, INDEXORD() will also return a zero.
$LANG_RU$
     INDEXORD()    .  
             
       .   , 
       ,      .
$DESCRIPTION$
     INDEXORD() is a database function that determines the position of the
     controlling index in the list of index files opened by the last
     USE...INDEX or SET INDEX TO in the current work area.  It is often
     useful to save the last controlling index so it can be restored later.

     By default, INDEXORD() operates on the currently selected work area.  It
     will operate on an unselected work area if you specify it as part of an
     aliased expression (see example below).
$LANG_RU$
     INDEXORD() -    ,    
            
     ,        
      USE...INDEX  SET INDEX TO.    
       ,     
     .

       INDEXORD()     ()
      .   ,     
       ,     ,
       (  ).
$EXAMPLES$
       This example uses INDEXORD() to save the current order.  After
	changing to a new order, it uses the saved value to restore the
	original order:

	USE Customer INDEX Name, Serial NEW
	nOrder := INDEXORD()                  // Result: 1
	SET ORDER TO 2
	? INDEXORD()                           // Result: 2
	SET ORDER TO nOrder
	? INDEXORD()                           // Result: 1

       This example uses an aliased expression to determine the order
	number of the controlling index in an unselected work area:

	USE Sales INDEX Salesman, CustNum NEW
	USE Customer INDEX Name, Serial NEW
	? Sales->(INDEXORD())               // Result: 1
$LANG_RU$
          INDEXORD()  
          .    
            
        :

       USE Customer INDEX Name, Serial NEW
       nOrder := INDEXORD()                  // : 1
       SET ORDER TO 2
       ? INDEXORD()                          // : 2
       SET ORDER TO nOrder
       ? INDEXORD()                          // : 1

             
              :

       USE Sales INDEX Salesman, CustNum NEW
       USE Customer INDEX Name, Serial NEW
       ? Sales --> (INDEXORD())              // : 1
$SEEALSO$
  INDEXKEY()
$END$
