xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

AFields()

Fills pre-allocated arrays with structure information of the current work area.

Syntax

AFields( [<aFieldName>], ;
         [<aFieldType>], ;
         [<aFieldLen>] , ;
         [<aFieldDec>]   ) --> nCount

Arguments

<aFieldNames>
A pre-allocated array to fill with the field names of the work area. Each element contains a character string.
<aFieldTypes>
A pre-allocated array to fill with the field types of the work area. Each element contains a single character.
<aFieldLen>
A pre-allocated array to fill with the field lengths of the work area. Each element contains a numeric value.
<aFieldDec>
A pre-allocated array to fill with the decimal places of the fields of the work area. Each element contains a numeric value.

Return

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.

Description

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.

Info

See also:AChoice(), AEval(), AScan(), DbCreate(), DbStruct()
Category: Array functions , Field functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe