lcType = TYPE( FIELD( i ) ) !( NVL( EVALUATE(FIELD(i)), Str2Exp( '' ) ) == NVL( OLDVAL(FIELD(i), "V_MYTABLE"), Str2Exp( '' ) ) )Here is Str2Exp:
*-- Passed a string and a data type, return the expression after conversion to the specified data type FUNCTION Str2Exp( tcExp, tcType ) *** Convert the passed string to the passed data type LOCAL luRetVal, lcType *** Remove double quotes (if any) tcExp = STRTRAN( ALLTRIM( tcExp ), CHR( 34 ), "" ) *** If no type passed -- display error message *** the FUNCTION is not clairvoyant IF TYPE( 'tcType' ) = 'C' lcType = UPPER( ALLTRIM( tcType ) ) ELSE *** Type is a required parameter. Let the developer know ERROR 'Missing Parameter: Expression type is a required parameter to Str2Exp' ENDIF *** Convert from Character to type DO CASE CASE INLIST( lcType, 'I', 'N' ) AND INT( VAL( tcExp ) ) == VAL( tcExp ) && Integer luRetVal = INT( VAL( tcExp ) ) CASE INLIST( lcType, 'N', 'Y') && Numeric or Currency luRetVal = VAL( tcExp ) CASE INLIST( lcType, 'C', 'M' ) && Character or memo luRetVal = tcExp CASE lcType = 'L' && Logical luRetVal = IIF( NOT EMPTY( tcExp ), .T., .F. ) CASE lcType = 'D' && Date luRetVal = CTOD( tcExp ) CASE lcType = 'T' && DateTime luRetVal = CTOT( tcExp ) OTHERWISE *** There is no otherwise unless, of course, Visual FoxPro adds *** a new data type. In this case, the function must be modified ENDCASE *** Return value as Data Type RETURN luRetVal ENDFUNC