EVALUATE( ) Function

Evaluates a character expression and returns the result.

EVALUATE(cExpression)

Return Value

Character, Numeric, Currency, Date, DateTime, Logical, or Memo

Parameters

  • cExpression
    Specifies the expression to evaluate. cExpression can be a literal character string, or a valid Visual FoxPro expression, variable, array element, or field of any data type, enclosed in quotation marks. cExpression cannot exceed 255 characters.

    Whenever possible, use EVALUATE( ) or a name expression to replace macro substitution using the & Command. EVALUATE and name expressions execute faster than macro substitution.

Remarks

EVALUATE( ) is similar to TYPE( ) but returns the result of an expression instead of the expression type. An expression containing EVALUATE( ) cannot be optimized by Rushmore Query Optimization.

Including the EVALUATE( ) function in the WHERE clause of a SQL query can return incorrect data.

Example

The following example uses the EVALUATE() function to evaluate a math expression stored in a character variable.

cMathFunc="INT(4.33)"
nResult=EVALUATE(cMathFunc)
?nResult

See Also

Concepts

Using Rushmore Query Optimization to Speed Data Access

Reference

TYPE( ) Function

_Evaluate( ) API Library Routine

Other Resources

Functions

Language Reference (Visual FoxPro)