xHarbour Reference Documentation > Function Reference |
Fills pre-allocated arrays with structure information of the current work area.
AFields( [<aFieldName>], ; [<aFieldType>], ; [<aFieldLen>] , ; [<aFieldDec>] ) --> nCount
The function returns a numeric value indicating the number of array elements filled. If no parameter is passed or if the work area is not used, the return value is zero.
AField() is used to obtain structural information about a database open in a work area. The function operates in the current work area unless it is prefixed with the alias operator.
One or more arrays must be pre-allocated to receive the desired information. Use function FCount() to dimension the arrays large enough to hold all avialable information.
Note that AFields exists for compatibility reasons. It is superseded by the DbSTruct() function, which retrieves all structural information in a multi-dimensional array.
See also: | AChoice(), AEval(), AScan(), DbCreate(), DbStruct() |
Category: | Array functions , Field functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example fills an array with field names and displays the // names and field contents within AEval(). PROCEDURE Main LOCAL aNames USE Customer aNames := Array( FCount() ) AFields( aNames ) AEval( aNames, {|cName| QOut(cName, &cName) } ) CLOSE ALL RETURN
http://www.xHarbour.com