Function FieldInfo() Foundation
Sets or returns the settings for a field.
FieldInfo( <nFieldPos>, <nDefine>, ;
[<xNewSetting>] ) --> xOldValue
The return value of FieldInfo() is the value for the field setting specified by <nDefine>. If this is a changeable setting and <xNewSetting> is specified, the function returns the old value.
The function FieldInfo() allows information about individual fields (field variables) in a work area to be accessed. To do this, a file must be open in the work area. If there is not an open file, a runtime error is generated when FieldInfo() is called. A detailed description of the information that can be retrieved using FieldInfo() is found in the chapter The Xbase++ Database Engine in the Xbase++ documentation.
// The example shows the UDF FieldStruct() which returns
// an array containing the structure of a single field.
// The array structure is the same as a subarray of the
// DbStruct() array.
#include "Dmlb.ch"
**************
PROCEDURE Main
USE Customer
? FieldName( 1 ) // result: CUSTOMERNO
? FieldStruct( 1 ) // result: {CUSTOMERNO, C, 6, 0}
USE
RETURN
*********************************
FUNCTION FieldStruct( nFieldPos )
RETURN { FieldName( nFieldPos ) , ; // field name
FieldInfo( nFieldPos, FLD_TYPE ) , ; // data type
FieldInfo( nFieldPos, FLD_LEN ) , ; // field length
FieldInfo( nFieldPos, FLD_DEC ) } // decimal places
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.