$FUNCNAME$
  FIELDNAME()
$CATEGORY$
  DATABASE
$SUMMARY$
   Return a field name from the current database (.dbf) file
$LANG_RU$
        (.dbf) .
$SYNTAX$
     FIELDNAME/FIELD(<nPosition>) --> cFieldName
$LANG_RU$
     FIELDNAME(< >) -->  
$ARGUMENTS$
     <nPosition> is the position of a field in the database file
     structure.
$LANG_RU$
     < >        
     .
$RETURNS$
     FIELDNAME() returns the name of the specified field as a character
     string.  If <nPosition> does not correspond to an existing field in the
     current database file or if no database file is open in the current work
     area, FIELDNAME() returns a null string ("").
$LANG_RU$
     FIELDNAME()         
        .      
     < > , FIELDNAME()   
     ("").
$DESCRIPTION$
     FIELDNAME() is a database function that returns a field name using an
     index to the position of the field name in the database structure.  Use
     it in data-independent applications where the field name is unknown.  If
     information for more than one field is required, use AFIELDS() to create
     an array of field information or COPY STRUCTURE EXTENDED to create a
     database of field information.

     If you need additional database file structure information, use TYPE()
     and LEN().  To obtain the number of decimal places for a numeric field,
     use the following expression:

     LEN(SUBSTR(STR(<idField>), RAT(".", ;

		 STR(<idField>)) + 1))

     By default, FIELDNAME() operates on the currently selected work area as
     shown in the example below.
$LANG_RU$
     FIELDNAME()     .  
      ,       
     ,     .

          ,  
      .       ,
        AFIELDS(),      
      ,   COPY STRUCTURE EXTENDED,  
         .

            
        ,    TYPE() 
     LEN().         
      ,    :

     LEN(SUBSTR(STR(< >), RAT(".", STR(< >)) + 1))

        FIELDNAME()    
     ()  .      
            
     ,     .
$EXAMPLES$
       These examples illustrate FIELDNAME() used with several other
	functions:

	USE Sales
	? FIELDNAME(1)              // Result: BRANCH
	? FCOUNT()                  // Result: 5
	? LEN(FIELDNAME(0))         // Result: 0
	? LEN(FIELDNAME(40))        // Result: 0

       This example uses FIELDNAME() to list the name and type of
	each field in Customer.dbf:

	USE Customer NEW
	FOR nField := 1 TO FCOUNT()
	   ? PADR(FIELDNAME(nField), 10),;
		  VALTYPE(&amp;(FIELDNAME(nField)))
	NEXT

       This example accesses fields in unselected work areas using
	aliased expressions:

	USE Sales NEW
	USE Customer NEW
	USE Invoices NEW
	//
	? Sales->(FIELDNAME(1))            // Result: SALENUM
	? Customer->(FIELDNAME(1))         // Result: CUSTNUM
$LANG_RU$
           FIELDNAME()  
        :

       USE Sales
       ? FIELDNAME(1)               // : BRANCH
       ? FCOUNT()                   // : 5
       ? LEN(FIELDNAME(0))          // : 0
       ? LEN(FIELDNAME(40))         // : 0

           FIELDNAME() 
              Customer.dbf:

       USE Customer NEW
       FOR nField := 1 TO FCOUNT()
	  ? PADR(FIELDNAME(nField), 10), VALTYPE(&amp;(FIELDNAME(nField)))
       NEXT

           , 
       ,        
        :

       USE Sales NEW
       USE Customer NEW
       USE Invoices NEW
       //
       ? Sales-> (FIELDNAME(1))     // : SALENUM
       ? Customer-> (FIELDNAME(2))  // : Custnum
$SEEALSO$
  AFIELDS(),DBSTRUCT(),FCOUNT(),LEN(),VALTYPE()
$END$
