FIELDWBLOCK()
Return a sets/gets code block for field in a given work area
- Syntax
- FIELDWBLOCK( <cFieldName>, <nWorkArea> ) --> bFieldBlock
- Arguments
- <cFieldName> is a string that contain the field name.
- <nWorkArea> is the work area number in which <cFieldName> exist.
- Returns
- FIELDWBLOCK() return a code block that when evaluate could retrieve field value or assigning a new value for a field in a given work area. If <cFieldName> is not specified or from type other than character, or if <nWorkArea> is not specified or is not numeric FIELDWBLOCK() return NIL.
- Description
- FIELDWBLOCK() return a code block that sets/gets the value of field from a given work area. 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 in work area number , the code block return NIL.
- Examples
- LOCAL bField
- // this block work on the field "name" that exist on work area 2
- bFiled := FIELDBLOCK( "name", 2 )
- // open a file named One in work area 1
- // that have a field named "name"
- SELECT 1
- USE One
- // open a file named Two in work area 2
- // it also have a field named "name"
- SELECT 2
- USE Two
- SELECT 1
- ? "Original names: ", One->name, Two->name
- ? "Name value for file Two :", EVAL( bField )
- EVAL( bField, "Two has new name" )
- ? "and now: ", One->name, Two->name
- Status
Ready
- Compliance
- If the block is evaluate and there is no field with the name in the given work area, the code block return NIL.
- CA-Clipper would raise BASE/1003 error if the field does not exist.
- Files
- Library is rtl
- See Also