Evaluates a FoxPro expression without blowing up by wrapping the EVALUATE() operation into an internal TRY/CATCH block.
String to evaluate - same value you would pass to EVALUATE()
The value to return when an error occurs Pass the special value** ERRORMESSAGE** to return the error message
You cannot pass expressions that contain local variables or the THIS pointer since they will not be in scope in the executing wrapper function.
<<code lang="VFP">>*** Execute 2 + 2 on Error -1 would be returned lnResult = SafeEval("2+2",-1) *** return the error message in lnResult lnResult = SafeEval("2+2+A","ERRORMESSAGE") IF VARTYPE(lnResult) = "C" ? lnResult && Error Message ENDIF <</code>>
See also:Class wwUtils
Comment or report problem with topic