Click or drag to resize

FieldGet Function

X#
Get the contents of a field that is identified by its position.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION FieldGet(
	nFieldPos
) AS USUAL CLIPPER
Request Example View Source

Parameters

nFieldPos (Optional)
Type: Usual
The position of the field in the database file structure for the current work area.

Return Value

Type: Usual
The value of the specified field.
If nFieldPos does not correspond to the position of any field in the current database file, FieldGet() will generate a runtime error. Only in the Xbase++ dialect a NIL will be returned.
Remarks
FieldGet() retrieves the value of a field using its position within the database file structure rather than its field name. Within generic database service functions this allows, among other things, the retrieval of field values without use of the macro operator.
Tip Tip
FieldGet() can be used with a BLOB field (that is, a memo field associated with a BLOB file), provided the length of the field does not exceed 64 KB.
For BLOB fields longer than 64 KB, use the BLOBGet() function instead.
Examples
This example compares FieldGet() to functionally equivalent code that uses the macro operator to retrieve the value of a field:
X#
1LOCAL nFieldPos := 1, FName, FVal
2USE customer NEW
3                                // Using macro operator
4FName := FIELDNAME(nFieldPos)            // Get field name
5FVal := &FName                        // Get field value
6                                // Using FieldGet()
7FVal := FieldGet(nFieldPos)                // Get field value
See Also