Return a code block that sets/gets a value for a given field
FIELDBLOCK( <cFieldName> ) --> bFieldBlock
<cFieldName> is a string that contain the field name.
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.
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.
// 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 )
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.
Library is rtl
EVAL(), FIELDWBLOCK(), MEMVARBLOCK()