xHarbour Reference Documentation > Function Reference |
Assigns a value to a field variable by its ordinal position.
FieldPut( <nFieldPos>, <xValue> ) --> xAssigneValue
The function returns the value assigned to the specified field variable, or NIL if <nFieldPos> is outside the valid range.
FieldPut() assigns a value to a field variable by using its ordinal position, rather than its field name. The ordinal position is determined by the sequence of field declarations when a database file is created. Ordinal positions begin with 1 and end with FCount().
See also: | DbFieldInfo(), FieldDec(), FieldGet(), FieldLen(), FieldName(), FieldPos(), FieldType(), REPLACE |
Category: | Database functions , Field functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates various possibilities of // assigning a value to a field variable. PROCEDURE Main LOCAL cField := "LASTNAME" , cLastName := "Miller" USE Customer NEW ALIAS Cust Cust->LASTNAME := cLastName // hard-coded assignment ? FieldPos( cField ) // result: 3 ? FieldPut( 3, cLastName ) // result: Miller // aliased expression Cust-> ( FieldPut( FieldPos(cField), cLastName ) ) USE RETURN
http://www.xHarbour.com