xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

FieldGet()

Retrieves the value of a field variable by its ordinal position.

Syntax

FieldGet( <nFieldPos> ) --> xFieldValue

Arguments

<nFieldPos>
A numeric value specifying the ordinal position of the field variable to query. Valid values are in the range from 1 to FCount().

Return

The function returns the value of the field variable at the specified position, or NIL if <nFieldPos> does not fall into the valid range.

Description

FieldGet() retrieves the value of a field variable by its ordinal position, rather than by 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().

Info

See also:FieldBlock(), FieldName(), FieldPut(), FieldWBlock()
Category: Database functions , Field functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example calls FieldGet() in the current work area
// and in a different work area using an aliased expression.

   PROCEDURE Main

      USE Customer ALIAS Cust
                                 // current work area
      ? FieldPos( "Lastname" )   // result: 3
      ? FieldGet(3)              // result: Miller

      SELECT 0                   // new work area
      ? Used()                   // result: .F.
      ? FieldGet(3)              // result: NIL

                                 // aliased expression
      ? Cust->(FieldGet(3))      // result: Miller

      CLOSE Cust
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe