FIELDBLOCK()
Return a code block that sets/gets a value for a given field
Syntax
FIELDBLOCK( <cFieldName> ) --> bFieldBlock
Arguments
<cFieldName> is a string that contain the field name.
Returns
FIELDBLOCK() return a code block that when evaluate could retrieve a field value or assigning a new value to the field. If <cFieldName> is not specified or from type other than character, FIELDBLOCK() return NIL.
Description
FIELDBLOCK() return a code block that sets/gets the value of field. When this code block is evaluated without any parameters passed then it returns the current value of the given field. If the code block is evaluated with a parameter, than its value is used to set a new value to the field, this value is also return by the block. If the block is evaluate and there is no field with the name <cFieldName> in the current work area, the code block return NIL.
Note that FIELDBLOCK() works on the current work area, if you need a specific work area code block use FIELDWBLOCK() instead.
Examples
// open a file named Test that have a field named "name" LOCAL bField bFiled := FIELDBLOCK( "name" ) USE Test ? "Original value of field 'name' :", EVAL( bField ) EVAL( bField, "Mr X new name" ) ? "New value for the field 'name' :", EVAL( bField )
Compliance
If the block is evaluate and there is no field with the name <cFieldName> in the current work area, the code block return NIL.
CA-Cl*pper would raise BASE/1003 error if the field does not exist.
Files
Library is rtl
Seealso
EVAL(), FIELDWBLOCK(), MEMVARBLOCK()
Pingback: Harbour All Functions – F | Viva Clipper !
Pingback: Variable Management Functions | Viva Clipper !