Harbour All Functions – F

Fact

Fahrenheit

FClose()
FCount()
FCreate()
FErase()
FError()
FieldBlock()

FieldDeci()

FieldGet()

FieldName()
FieldPos()
FieldPut()

FieldSize()
FieldType()

FieldWBlock()

File()
FLock()

Floor

FOpen()

Found()

FRead()
FReadStr()
FRename()
FSeek()

FToC

FV

FWrite()

Variable Management Functions

Variable Management

FieldBlock Return a code block that sets/gets a value for a given field
FieldWBlock Return a sets/gets code block for field in a given work area
HB_AParams Returns an array containing values of all parameters passed to a function, method or procedure
HB_ArgC Returns the number of command line arguments
HB_ArgCheck Checks existence of an internal switch on the command line
HB_ArgShift Updates HB_Arg* parameter list removing the 1-st one and replacing it by others
HB_ArgString Retrieves the vale of an internal switch set on the command line.
HB_ArgV Retrieves the value of a command line argument
HB_PIsByRef Determine if a parameter is passed by reference.
HB_PValue Retrieves the value of an argument.
HB_ValToStr Converts any scalar type to a string.
MemVarBlock Returns a codeblock that sets/gets a value of memvar variable
PCount Retrieves the number of arguments passed to a function.
Type Retrieves the type of an expression
ValType Retrieves the data type of an expression

FieldWBlock()

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 <cFieldName> in work area number <nWorkArea>, 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

Compliance

If the block is evaluate and there is no field with the name <cFieldName> in the given 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(), FIELDBLOCK(), MEMVARBLOCK()

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

C5_FIELDBLOCK

 FIELDBLOCK()
 Return a set-get code block for a given field
------------------------------------------------------------------------------
 Syntax

     FIELDBLOCK(<cFieldName>) --> bFieldBlock

 Arguments

     <cFieldName> is the name of the field to which the set-get block
     will refer.

 Returns

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

 Description

     FIELDBLOCK() is a database function that builds a code block.  When
     executed with an argument, the code block created by this function
     assigns the value of the argument to <cFieldName>.  When executed
     without an argument, the code block retrieves the value of <cFieldName>.

     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

     .  Work area: The code block returned by FIELDBLOCK() sets or
        gets the value of the specified field in whatever work area is
        current when the block is run.  For example, given work areas 1 and
        2, both containing field FName:

     SELECT 1
        FName:= "Kate"
        SELECT 2

        FName := "Cindy"
        bFName := FIELDBLOCK("FName")
        SELECT 1
        ? EVAL(bFName)               // Result: "Kate"
        SELECT 2
        ? EVAL(bFName)               // Result: "Cindy"

        The function FIELDWBLOCK() provides a set-get block for a field in a
        specific work area.

 Examples

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

        // Set-Get block defined using macro operator
        bSetGet := &( "{ |setVal| IF( setVal == NIL,;
                        FName, FName := setVal ) }" )
        // Set-Get block defined using FIELDBLOCK()

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

 Files   Library is CLIPPER.LIB.

See Also: FIELDWBLOCK() MEMVARBLOCK()



Code blocks, inside and out

 

Code blocks, inside and out

 

TBrowse & TBColumn basics

TBrowse and TBColumn basics (.pdf)

Working version of sample program in this article.

 

TBr_Bass

Try these new 5.01 language constructs

Try these new 5.01 language constructs