[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FIELDWBLOCK()
 Return a set-get code block for a field in a given work area
------------------------------------------------------------------------------
 Syntax

     FIELDWBLOCK(<cFieldName>, <nWorkArea>)
        --> bFieldWBlock

 Arguments

     <cFieldName> is the name of the field specified as a character
     string.

     <nWorkArea> is the work area number where the field resides
     specified as a numeric value.

 Returns

     FIELDWBLOCK() returns a code block that, when evaluated, sets (assigns)
     or gets (retrieves) the value of <cFieldName> in the work area
     designated by <nWorkArea>.  If <cFieldName> does not exist in the
     specified work area, FIELDWBLOCK() returns an empty block.

 Description

     FIELDWBLOCK() is a database function that builds a code block.  When
     evaluated with the EVAL() function, the code block first selects the
     designated <nWorkArea>.  If an argument was passed, the code block then
     assigns the value of the argument to <cFieldName>.  If no argument was
     passed, the code block retrieves the value of <cFieldName>.  The
     original work area is then reselected before the code block returns
     control.

     Note that the specified field variable may not exist when the code block
     is created but must exist before the code block is executed.

 Notes

     .  FIELDWBLOCK() is similar to FIELDBLOCK(), except that
        FIELDBLOCK() incorporates a fixed work area into the set-get block.

 Examples

     .  This example compares FIELDWBLOCK() to a code block created
        using the macro operator.  Note that using FIELDWBLOCK() avoids the
        speed and size overhead of the macro operator:

        // Set-Get block for work area 1 defined with
        // macro operator
        bSetGet := &( "{ |setVal| IF( setVal == NIL, ;
           1->FName, 1->FName := setVal ) }" )
        // Set-Get block defined using FIELDWBLOCK()

        // bSetGet created here is the functional
        // equivalent of bSetGet above
        bSetGet := FIELDWBLOCK("FName", 1)

 Files   Library is CLIPPER.LIB.


See Also: FIELDBLOCK() MEMVARBLOCK()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson