FieldBlock()

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()

2 responses to “FieldBlock()

  1. Pingback: Harbour All Functions – F | Viva Clipper !

  2. Pingback: Variable Management Functions | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.