>Hi Sorin,
>
>---------
>From the VFP help
>QUOTE
>Evaluates a character expression and returns the result.
>EVALUATE(cExpression)
>UNQUOTE
>
>As NULL is not an expression, you cannot evaluate it, thus you get an error as desirable, expactable and preventable.
>You may want to try EVALUATE("NULL") which is a character expression with the NULL value. This returns NULL.
>---------
>
>This is the interpretation of VFP, today.
>
>I prefer to extend the concept:
>
>sExp = 'NULL' is a defined expression
>sExp = NULL is a undefined expression, but it is a expression.
>
>sExp = "'A'+1" this is not a expression.
>
>
>Fabio
Fabio,
You may want to try:
EVALUATE("any_string_value_that_is_not_a_logical_sentence") => Error
EVALUATE(1) => Error
EVALUATE(.T.) =>Error
EVALUATE(any_data_type_value_including_NULL) => ERROR
In other words (IOW), you canot apply the function (EVALUATE() in this case) beyond it's finality. You already know the value, it does not make sense to EVALUATE it any further.
Case 1.
sExp = 'NULL' - is a defined expression, where the var sExp expresses 'NULL'. In this case both EVALUATE("sExp = 'NULL'") and EVALUATE(sExp) make logical sense.
Case 2.
sExp = NULL - is an expression only as "sExp = NULL" where the text string expresses that sExp = NULL, IOW the expression is that sExp is undefined. NULL is a value, not an expression.
Therefore, only EVALUATE("sExp = NULL") makes sense. EVALUATE(NULL) does not make sense => ERROR.
Case 3.
sExp = "'A'+1" is an expression only when where sExp expresses the string "'A'+1". Otherwise, it's value "'A'+1" does not express a logical statement. Basically is the same thing with sExp = NULL, where the expression is that a variable has a value. The variable's value does not represent a logical statemnt, therefore the logical reasoning does not apply => ERROR.
Does it make (common) sense? :)