General information
Category:
Coding, syntax & commands
Hello Bill,
I don't have 7.0 around to try to figure out why the #IF did not handle it.
There are 2 versions of SafeEval in the code.
Just comment out the VFP 8 version as follows:
**************************************************************************************************
** SafeEval:
** Parameter is string that is a FoxPro expression
** Evaluate() gives us the value
** we force result to string with TRANSFORM() and catch any errors
** Version for VFP 8 uses Try / Catch
** Version for VFP 5,6,7 uses Error Trapping Object
**************************************************************************************************
*!* #IF VAL(VERSION(4)) > 7.99
*!* HIDDEN FUNCTION SafeEval(tcVar as String)
*!* ** Works with VFP 8
*!* TRY
*!* ** attempt to eval this merge var
*!* ** TRANSFORM will convert any type to a string
*!* lcValue = ALLTRIM(TRANSFORM(EVALUATE(This.StripRTF(tcVar))))
*!* CATCH
*!* ** in case merge var mis-spelled, etc.
*!* lcValue = [***ERROR in ]+tcVar+[: ] + Message()+[***]
*!* ENDTRY
*!* RETURN lcValue
*!* ENDFUNC
*!* #ELSE
*****************************************************
** BILL **
** The following is the version of SafeEval for 7.0 **
*****************************************************
HIDDEN FUNCTION SafeEval(tcvar as String)
** Works with all versions of VFP
LOCAL lcEval
lcEval = CREATEOBJECT("tEvaluator")
RETURN lcEval.Eval(This.StripRTF(tcVar))
ENDFUNC
*!* #ENDIF
>Hi Michael
>I loaded Merge.prg into a vfp7.1 project and when I went to compile it, got "Unrecognized command verb" errors for Try & EndTry. Can't find any ms help in vfp7 help files so I am guessing that Try & EndTry are vfp8 additions. Is this true?
>I probably could get around this by using "DO While .T." but then would have to figure how to determine when to exit the routine.
>
>Bill Wright
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only