FieldType()

FieldType()

Determines the type of a given field.

Syntax

      FieldType(<nFieldNum>) --> cFieldType

Arguments

<nFieldNum> Data field , which type need to be determined.

Returns

FieldType() returns the character that designates the type of a given field:</par>

      'C'   character string;
      'N'   numeric;
      'L'   logical;
      'D'   date;
      'M'   memo.

Description

This function determines the type of a field, designated by its number.

Examples

      PROCEDURE Main()
         LOCAL i
         USE tests NEW
         FOR i := 1 TO FCount()
            ? FieldType( i )
         NEXT
         USE
         RETURN

Compliance

This function is CA-Cl*pper tools compatible

Files

Library is libmisc

Seealso

FCount(), FieldNum(), FieldName(), FieldSize(), DBF Structure

FieldSize()

FieldSize()

Determines the size of a given field.

Syntax

      FieldSize(<nFieldNum>) --> nFieldSize

Arguments

<nFieldNum> Data field , which size need to be determined.

Returns

FieldSize() returns the number that designates the size of a given field.

Description

This function determines the size of a field, designated by its number.

Examples

      PROCEDURE Main()
         LOCAL i
         USE tests NEW
         FOR i := 1 TO FCount()
            ? FieldSize( i )
         NEXT
         USE
         RETURN
      xed>

Compliance

This function is CA-Cl*pper tools compatible

Files

Library is libmisc

Seealso

FCount(), FieldNum(), FieldName(), FieldType(), FieldSize(), DBF Structure

FieldDeci()

FieldDeci()

Determines the number of decimal places of a given numeric field.

Syntax

      FieldDeci(<nFieldNum>) --> nFieldDeci

Arguments

<nFieldNum> Numeric data field , for which number of decimal places need to be determined.

Returns

FieldDeci() returns the numeric value that designates the number of decimal places of a given field.

Description

This function determines the number of decimal places of a given numeric field.

Examples

      PROCEDURE Main()
         LOCAL i
         USE tests NEW
         FOR i := 1 TO FCount()
            ? FieldDeci( i )
         NEXT
         USE
         RETURN
      xed>

Compliance

This function is CA-Cl*pper tools compatible

Files

Library is libmisc

Seealso

FCount(), FieldNum(), FieldName(), FieldType(), FieldSize(), DBF Structure

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

Harbour Database Functions

Database Functions

AFields Fills referenced arrays with database field information
Alias Returns the alias name of a work area
BOF Test for the beggining-of-file condition
dbAppend Appends a new record to a database file
dbClearFilter Clears the current filter condiction in a work area
dbCloseAll Close all open files in all work areas.
dbCloseArea Close a database file in a work area
dbCommit Updates all index and database buffers for a given workarea
dbCommitAll Flushes the memory buffer and performs a hard-disk write
dbCreate Creates an empty database from a array
dbDelete Mark a record for deletion in a database
dbEval Performs a code block operation on the current Database
DBF Alias name of a work area
dbFilter Return the filter expression in a work area
dbGoBottom Moves the record pointer to the bottom of the database
dbGoto Position the record pointer to a specific location
dbGoTop Moves the record pointer to the top of the database
dbRecall Recalls a record previousy marked for deletion
dbSeek Searches for a value based on an active index
dbSelectArea Change to another work area
dbSetDriver Establishes the RDD name for the selected work area
dbSetFilter Establishes a filter condition for a work area
dbSkip Moves the record pointer in the selected work area
dbSkipper Helper function to skip a database
dbStruct Builds a multidimensional array of a database structure
dbUseArea Opens a work area and uses a database file
Deleted Tests the record’s deletion flag
EOF Test for end-of-file condition
FCount Counts the number of fields in an active database
FieldDeci Determines the number of decimal places of a given numeric field
FieldGet Obtains the value of a specified field
FieldName Return the name of a field at a numeric field location
FieldPos Return the ordinal position of a field
FieldPut Set the value of a field variable
FieldSize Determines the size of a given field
FieldType Determines the type of a given field
Found Determine the success of a previous search operation
Header Return the length of a database file header
LastRec Returns the number of records in an active work area or database
LUpdate Yields the date the database was last updated
RecCount Counts the number of records in a database
RecNo Returns the current record number or identity
RecSize Returns the size of a single record in an active database
Select Returns the work area number for a specified alias
Used Checks whether a database is in use in a work area

RecSize()

RECSIZE()

Returns the size of a single record in an active database.

Syntax

      RECSIZE() --> nBytes

Arguments

(This function has no arguments)

Returns

<nBytes> The record size.

Description

This function returns the number os bytes used by a single record in the currently selected or designated database file. If no database is in use in this work area, the return value from this function will be 0.

Examples

      USE tests NEW
      DBGOTOP()
      RECSIZE()            // Returns 1
      DBGOTO( 50 )
      RECSIZE()

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), FIELDNAME(), HEADER(), LASTREC()

LUpdate()

LUPDATE()

Yields the date the database was last updated.

Syntax

      LUPDATE() --> dModification

Arguments

(This function has no arguments)

Returns

<dModification> The date of the last modification.

Description

This function returns the date recorded by the OS when the selected or designated database was last written to disk. This function will only work for those database files in USE.

Examples

      PROCEDURE Main()
         USE tests NEW
         ? LUpdate()
         USE
         RETURN

Compliance

Clipper

Platforms

All

Files

Library is rdd

Seealso

FIELDNAME(), LASTREC(), RECSIZE()

FieldPos()

FIELDPOS()

Return the ordinal position of a field.

Syntax

      FIELDPOS(<cFieldName>) --> nFieldPos

Arguments

<cFieldName> Name of a field.

Returns

<nFieldPos> is ordinal position of the field.

Description

This function return the ordinal position of the specified field <cField> in the current or aliased work areaIf there isn’t field under the name of <cField> or of no database is open in the selected work area, the func- tion will return a 0.

Examples

      PROCEDURE Main()
         USE test NEW
         ? test->( FIELDPOS( "ID" ) )
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

FIELDGET(), FIELDPUT()

FCount()

FCOUNT()

Counts the number of fields in an active database.

Syntax

      FCOUNT() --> nFields

Returns

<nFields> Return the number of fields

Description

This function returns the number of fields in the current or designated work area. If no database is open in this work area, the function will return 0.

Examples

      PROCEDURE Main()
         USE tests NEW
         ? "This database have", tests->( FCOUNT() ), "Fields"
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

FIELDNAME(), TYPE()

C5_FIELDNAME()

 FIELDNAME() / FIELD()
 Return a field name from the current database (.dbf) file
------------------------------------------------------------------------------
 Syntax

     FIELDNAME/FIELD(<nPosition>) --> cFieldName

 Arguments

     <nPosition> is the position of a field in the database file
     structure.

 Returns

     FIELDNAME() returns the name of the specified field as a character
     string.  If <nPosition> does not correspond to an existing field in the
     current database file or if no database file is open in the current work
     area, FIELDNAME() returns a null string ("").

 Description

     FIELDNAME() is a database function that returns a field name using an
     index to the position of the field name in the database structure.  Use
     it in data-independent applications where the field name is unknown.  If
     information for more than one field is required, use AFIELDS() to create
     an array of field information or COPY STRUCTURE EXTENDED to create a
     database of field information.

     If you need additional database file structure information, use TYPE()
     and LEN().  To obtain the number of decimal places for a numeric field,
     use the following expression:

     LEN(SUBSTR(STR(<idField>), RAT(".", ;

                 STR(<idField>)) + 1))

     By default, FIELDNAME() operates on the currently selected work area as
     shown in the example below.

 Examples

     .  These examples illustrate FIELDNAME() used with several other
        functions:

        USE Sales
        ? FIELDNAME(1)              // Result: BRANCH
        ? FCOUNT()                  // Result: 5
        ? LEN(FIELDNAME(0))         // Result: 0
        ? LEN(FIELDNAME(40))        // Result: 0

     .  This example uses FIELDNAME() to list the name and type of
        each field in Customer.dbf:

        USE Customer NEW
        FOR nField := 1 TO FCOUNT()
           ? PADR(FIELDNAME(nField), 10),;
                  VALTYPE(&(FIELDNAME(nField)))
        NEXT

     .  This example accesses fields in unselected work areas using
        aliased expressions:

        USE Sales NEW
        USE Customer NEW
        USE Invoices NEW
        //
        ? Sales->(FIELDNAME(1))            // Result: SALENUM
        ? Customer->(FIELDNAME(1))         // Result: CUSTNUM

 Files   Library is CLIPPER.LIB.

See Also: AFIELDS()* COPY STRU EXTE DBSTRUCT() FCOUNT()