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

SP_WORKBLOCK

WORKBLOCK()

  Short:
  ------
  WORKBLOCK() Returns a set-get block for field named in an
  expression

  Returns:
  --------
  <bBlock> => a set-get block

  Syntax:
  -------
  WORKBLOCK(cExpress)

  Description:
  ------------
  Determines the work area and field name in <cExpress>
  and returns a FIELDWBLOCK() created block for it.

  Examples:
  ---------
   cExpr := "CUSTOMER->LNAME"

   bExpr := WORKBLOCK(cExpr)

   ?eval(bExpr)              // displays value

   ?eval(bExpr,"SMITH")    // sets new value

  Source:
  -------
  S_FIELDS.PRG

 

C5_FIELDWBLOCK

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



Code blocks, inside and out

 

Code blocks, inside and out