Click or drag to resize

FieldGetBytes Function

X#
Get the contents of a field that is identified by its position.
Read an array of bytes direct from the workarea buffer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION FieldGetBytes(
	nFieldPos
) AS BYTE[] 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: Byte
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.

Return Value

Type: Byte
The value of the field as an array of bytes. IF nFieldPos does not correspond to the position of any field in the database file, FieldGetBytes() will generate an error.
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.
Remarks
This will only work for DBF based workareas (not for Advantage workareas)
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