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

FieldName()

FIELDNAME()

Return the name of a field at a numeric field location.

Syntax

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

Arguments

<nPosition> Field order in the database.

Returns

<cFieldName> returns the field name.

Description

This function return the name of the field at the <nPosition>th position. If the numeric value passed to this function does not correspond to an existing field in the designated or selected work area, this function will return a NULL byte.

Examples

      PROCEDURE Main()
         LOCAL x
         USE tests NEW
         FOR x := 1 TO tests->( FCOUNT() )
            ? "Field Name", FieldName( x )
         NEXT
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

DBSTRUCT(), FCOUNT(), LEN(), VALTYPE()

C5_FCOUNT

 FCOUNT()
 Return the number of fields in the current .dbf file
------------------------------------------------------------------------------
 Syntax

     FCOUNT() --> nFields

 Returns

     FCOUNT() returns the number of fields in the database file in the
     current work area as an integer numeric value.  If there is no database
     file open, FCOUNT() returns zero.

 Description

     FCOUNT() is a database function.  It is useful in applications
     containing data-independent programs that can operate on any database
     file.  These include generalized import/export and reporting programs.
     Typically, you use FCOUNT() to establish the upper limit of a FOR...NEXT
     or DO WHILE loop that processes a single field at a time.

     By default, FCOUNT() operates on the currently selected work area.

 Examples

     .  This example illustrates FCOUNT(), returning the number of
        fields in the current and an unselected work area:

        USE Sales NEW
        USE Customer NEW
        ? FCOUNT()                     // Result: 5
        ? Sales->(FCOUNT())            // Result: 8

     .  This example uses FCOUNT() to DECLARE an array with field
        information:

        LOCAL aFields := ARRAY(FCOUNT())
        AFIELDS(aFields)

     .  This example uses FCOUNT() as the upper boundary of a FOR loop
        that processes the list of current work area fields:

        LOCAL nField
        USE Sales NEW
        FOR nField := 1 TO FCOUNT()
           ? FIELD(nField)
        NEXT

 Files   Library is CLIPPER.LIB.

See Also: AFIELDS()* FIELDNAME() TYPE()



CT_FIELDTYPE

 FIELDTYPE()
 Determines the data type for a field

 Syntax

     FIELDTYPE(<nField>) --> cType

 Argument

     <nField>  Designates the data field for which the data type is
     determined.

 Returns

     FIELDTYPE() returns a single character that designates the data type of
     the data field (assuming the data field number is valid).  FIELDTYPE()
     returns the following characters for the various data field types:

     Table 10-1: Coding for Data Field Types
     ------------------------------------------------------------------------
     Character    Data Type
     ------------------------------------------------------------------------
     C            Character string
     N            Numeric
     D            Date
     L            Logical
     M            MEMO
     ------------------------------------------------------------------------

 Description

     FIELDTYPE() operates in a similar fashion to the CA-Clipper TYPE()
     function.  With TYPE(), you must always know only the name of the data
     field.  However, FIELDTYPE() requires that you only know the data field,
     not its name.  Use the function to confirm data types for data fields
     when a program is working with different databases that have different
     field names.

 Note

     .  If there are  invalid data field numbers, the function returns
        a null string.

 Example

     Data type for field number 5:

     IF FIELDTYPE(5) = "C"
        ? "Field No. 5 is a character field!"
     ENDIF

See Also: FCOUNT, FIELDNUM, FIELDNAME,  FIELDSIZE, FIELDDECI,  DBF Structure



CT_FIELDSIZE

FIELDSIZE()
 Determines the size of a field
------------------------------------------------------------------------------
 Syntax

     FIELDSIZE(<nField>) --> nLength

 Argument

     <nField>  Designates the number of the field to evaluate.

 Returns

     FIELDSIZE() returns a numeric value that corresponds to the field length
     of a valid field number.

 Description

     Use FIELDSIZE() to determine the length (or size) of data field of
     desired data types.  This determines the window width needed for output
     to appear without a line break, or the length needed for an input to
     automatically fit in the database.

 Note

     .  If there is an invalid data field number, the function returns
        a value of 0.

 Example

     Determine the total length of fields 3 to 5:

     nLength  :=  0
     FOR I = 3 TO 5
        nLength := nLength + FIELDSIZE()
     NEXT

See Also:  FCOUNT, FIELDNUM, FIELDNAME, FIELDTYPE, FIELDDECI, PAD, STR, DBF Structure

CT_FIELDNUM

FIELDNUM()
 Determines the field number for a specific field in a database file
------------------------------------------------------------------------------
 Syntax

     FIELDNUM(<cFieldName>) --> nFieldNumber

 Argument

     <cFieldName>  Designates to the field name.

 Returns

     FIELDNUM() returns the number of the data field.

 Description

     FIELDNUM() is the exact opposite of the CA-Clipper FIELD() function.
     Use this function when you need a data field number instead of the data
     field name.  FIELDNUM() determines if a symbol name pertains to a data
     field or a memory variable (see Examples).

 Note

     .  If a data field with the name <cFieldName> is not available,
        the function returns a value of 0.

 Example

     Is it a field or a variable?

     IF FIELDNUM("cName") > 0.
        REPLACE cName WITH UPPER(cName).
     ELSE.
        cName  :=  UPPER(cName).
     ENDIF

See Also:  FCOUNT,  FIELDNAME, FIELDTYPE, FIELDSIZE, FIELDDECI, PAD, STR, DBF Structure