Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>fieldwblock()</b> http://www.X-Hacker.org [<<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 NIL.

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

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson