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

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

 

CT_FIELDDECI

FIELDDECI()
 Determines the number of decimal places in a field
------------------------------------------------------------------------------
 Syntax

     FIELDDECI(<nField>) --> nDecimalPlaces

 Argument

     <nField>  Designates for which numeric data field to determine the
     number of decimal places.

 Returns

     When a field number is valid, FIELDDECI() returns the number of decimal
     places in a numeric data field.

 Description

     It is important to know how many decimal places are in a data field so
     you can limit the input of significant digits in the corresponding
     number.  FIELDDECI() determines the number of decimal places available.
     This allows you to tailor inputs to the database without changing the
     program.

 Note

     .  If you have an invalid field number, the function returns a
        value of 0.

 Example

     Convert the second field to a string with the correct number of decimal
     places:

     @ 0, 60 SAY "Price:  " + STR(cField2, 8, FIELDDECI(2))

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