AFields Function | |
Fill arrays with the structure of the current database file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION AFields(
acFieldNames,
acTypes,
anWidths,
anDecimals
) AS DWORD CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static uint AFields(
Usual acFieldNames = default,
Usual acTypes = default,
Usual anWidths = default,
Usual anDecimals = default
)
Request Example
View SourceParameters
- acFieldNames (Optional)
- Type: Usual
The array to fill with field names. - acTypes (Optional)
- Type: Usual
The array to fill with the type of fields in acFieldNames.
- anWidths (Optional)
- Type: Usual
The array to fill with the widths of fields in acFieldNames.
- anDecimals (Optional)
- Type: Usual
The array to fill with the number of decimals defined for fields in acFieldNames.
If the field type is not numeric, the system assigns 0 to anDecimals.
Return Value
Type:
DWord
The number of fields or the length of the shortest array argument, whichever is less.
If no arguments are specified, or if there is no file in use in the current work area, AFields() returns 0.
Remarks Tip |
---|
AFields() is a compatibility function and therefore not recommended.
It is superseded by DBStruct(), which does not require the existence of any arrays prior to invocation and returns a multidimensional array containing the current database file structure.
|
AFields() fills a series of arrays (structure attribute arrays) with the structure of the database file currently open, one element in each array per field.
AFields() works like ADir(), filling a series of existing arrays with information.
To use AFields(), you must first create the arrays to hold the database structure information, each with the same number of elements as the number of fields (that is, FCount()). Once the structure attribute arrays exist, you can then invoke AFields() to fill them with information about each field.
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying
it within an aliased expression
Examples
This example uses AFields() with an aliased expression to fill arrays with the structure of SALES.DBF, open in an unselected work area:
1PROCEDURE Start()
2 LOCAL acFieldNames, aTypes, aWidths, ;
3 aDecimals AS ARRAY
4 USE sales NEW
5 USE customer NEW
6 acFieldNames := Sales->(ArrayNew(FCount()))
7 acTypes := Sales->(ArrayNew(FCount()))
8 anWidths := Sales->(ArrayNew(FCount()))
9 anDecimals := Sales->(ArrayNew(FCount()))
10 Sales->(AFields(acFieldNames, acTypes, anWidths, anDecimals))
See Also