Function AFields() Foundation

Fills a set of arrays with information about the fields in a work area.

Syntax
AFields( [<aFieldName>], ;
         [<aFieldType>], ;
         [<aFieldLen>] , ;
         [<aFieldDec>]   ) --> nFieldCount
Parameters
<aFieldName>
<aFieldName> is an array into which the names of the fields in the work area are placed. Each element of <aFieldName> contains a character string.
<aFieldType>
<aFieldType> is an array into which the field types of the fields in <aFieldName> are placed. The elements of <aFieldType>contain character strings.
<aFieldLen>
<aFieldLen> is an array into which the field lengths of the fields in <aFieldName> are placed. The elements of <aFieldLen>contain integer numeric values.
<aFieldDec>
<aFieldDec> is an array into which the decimal places of the fields in <aFieldName> are placed. The elements of <aFieldDec>contain integer numeric values.
Return

The return value of AFields() is a positive integer corresponding to the number of fields for which structure information was written into the arrays. It is the value of the function FCount() or the length of the shortest array passed (the lesser of these two values). If no file is open in the work area or no arguments are passed, AFields() returns zero.

Description

The function AFields() exists only for compatibility reasons. Instead of AFields(), the function DbStruct() should be used. DBStruct() returns the file structure in a two dimensional array.

The array function AFields() places information about the file structure of an opened DBF file into a set of arrays. When the function is used without the alias operator, it fills the arrays with the structure information for the file in the current work area. Arrays with the length FCount() should be passed to the function.

Examples
AFields()
// The example generates four arrays, fills them with 
// data on the structure of a DBF file, and then displays 
// the information. 

PROCEDURE Main 
   LOCAL aField, aType, aLen, aDec 

   USE Customer NEW 

   aField := Array( FCount() ) 
   aType  := Array( FCount() ) 
   aLen   := Array( FCount() ) 
   aDec   := Array( FCount() ) 

   AFields( aField, aType, aLen, aDec ) 

   AEval( aField, {|cField, i| ; 
                   QOut( cField, aType[i], aLen[i],aDec[i]) } ) 
   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.