Click or drag to resize

Functions.FieldPut Method

Set the value of a field identified by its position.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.18
	nFieldPos AS USUAL,
	uNewValue AS USUAL
Request Example View Source


Type: Usual
The position of the field in the database file structure.
Type: Usual
The value to assign to the field.
The data type of this expression must match the data type of the field.

Return Value

Type: Usual
The value assigned to the field. If nFieldPos does not correspond to the position of any field in the database file, FieldPut() will generate an error. The exception to this is the XBase++ dialect where an invalid nFieldPos will not generate an exception but will return NIL.
FieldPut() allows you to set 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 setting of field values without use of the macro operator. Note: FieldPut() 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. 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
Shared mode:
For a shared database, this function requires a record lock.
This example compares FieldPut() to functionally equivalent code that uses the macro operator to set the value of a field:
1// Using macro operator
2FName := FIELDNAME(nFieldPos)                // Get field name
3_FIELD->&FName := FVal                    // Set field value
4// Using FieldPut()
5FieldPut(nFieldPos, FVal)                    // Set field value
See Also