Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>datatype()*</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DATATYPE()*
 Determines the data type of a variable or UDF
------------------------------------------------------------------------------
 Syntax

     DATATYPE(<expValue>) --> nDataType

     *  This is retained in CA-Clipper for compatibility purposes.  Use the
        CA-Clipper VALTYPE() function to develop future applications.

 Argument

     <expValue>  Designates any valid CA-Clipper expression.

 Returns

     DATATYPE() returns a value that corresponds to the data type in
     <expValue>.

 Description

     DATATYPE() is similar to the CA-Clipper TYPE() function, but returns
     more extensive information in numeric value form.  The bits in the
     result correspond to specific data types.  Two bits can be set at the
     same time.  It is easy to recognize specific data types with the ISBIT()
     function.  The following codes apply:

     Table 13-2: Data Type Coding
     ------------------------------------------------------------------------
     Value   Symb. Const.   Data Type
     ------------------------------------------------------------------------
      0      TYPE_UNDEF     Undefined
      1      TYPE_STR       Character string
      2      TYPE_NUM       Numeric
      4      TYPE_LOG       Logical
      8      TYPE_DATE      Date
     16      TYPE_ALIAS     Alias
     64      TYPE_MEMO      Memo field
     128     TYPE_WORD      Word
     512     TYPE_ARRAY     Array
     4096    TYPE_BLOCK     Code block
     ------------------------------------------------------------------------

     In addition, DATATYPE() returns the respective data type for a
     CA-Clipper Tools function or one of your own UDF's.  This is impossible
     with TYPE().

 Notes

     .  An invalid <expValue> output results in a runtime error.

     .  The function cannot determine if a parameter has passed to a
        function by reference (32 + type), because this information is no
        longer available in CA-Clipper.

 Example

     Return values of DATATYPES() used for different data types:

     ? DATATYPE()                 //    0, undefined
     ? DATATYPE("XXX")            //    1, string
     ? DATATYPE(123)              //    2, numeric
     ? DATATYPE(DOY())            //    2, numeric result
     ? DATATYPE(.T.)              //    4, logical
     ? DATATYPE(3 > 2)            //    4, logical expression
     ? DATATYPE(EOF())            //    4, logical result
     ? DATATYPE(DATE())           //    8, date
     ? DATATYPE(memofld)          //    1, memo field
     ? DATATYPE(@crlf)            //   33, reference to string
     ? DATATYPE(@array)           //  544, reference to array
     ? DATATYPE(array[1])         //    2, numeric element
     ? DATATYPE(array[2])         //    1, string element
     ? DATATYPE(myfunc())         //       type for your own UDF


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson