Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Evaluates an expression and returns the data type of its contents.
TYPE(cExpression)
Return Values
Character
Parameters
- cExpression
Specifies the expression to be evaluated, which can be a variable, field, memo field, or any other expression. The expression must be passed as a character string; place quotation marks around the names of memory variables, fields, and so on. If you do not place quotation marks around the expression, the TYPE( ) function evaluates the contents of the string. If the contents cannot be evaluated as a valid FoxPro expression, TYPE() returns "U" (undefined expression).
Remarks
The following table lists the character values TYPE( ) returns and their corresponding data types:
Data type | Character returned |
---|---|
Character | C |
Numeric (also float, double, and integer) | N |
Currency | Y |
Date | D |
DateTime | T |
Logical | L |
Memo | M |
Object | O |
General | G |
Screen (created with SAVE SCREEN) | S |
Undefined type of expression | U |
Example
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer && Opens Customer table
nTest = 1.01
cTest = "String"
CLEAR
? TYPE('customer.contact') && Displays C
? TYPE('(12 * 3) + 4') && Displays N
? TYPE('DATE( )') && Displays D
? TYPE('.F. OR .T.') && Displays L
? TYPE('ANSWER=42') && Displays U
? TYPE('$19.99') && Displays Y
? TYPE('nTest') && Displays N
? TYPE('cTest') && Displays C