Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Type function is not smart enough
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00714883
Message ID:
00714958
Views:
24
This message has been marked as a message which has helped to the initial question of the thread.
>
>theFld=thisform.edtReplaceFld.value && "trimzero(StNumExt)"
>theType=type(m.theFld)
&& Returns U
>
>I dont' think, I can use & or evaluate function here...

IMO, you can't avoid traping the error in this case (via ON ERROR, or Error method)
theFld=thisform.edtReplaceFld.value && "trimzero(StNumExt)"
ON ERROR m.VarToCheck = Null
m.VarToCheck = eval(theFld)
ON ERROR   && whatever was before
? vartype(m.VarToCheck)  && this will not fail
If you want a more elegant solution, define an "evaluator" class with error control, and use
oEvaluator = createobject("Evaluator")
m.VarToCheck = oEvaluator.Eval(theFld) && avoids placing ON ERROR in each evaluation
? vartype(m.VarToCheck)  && this will not fail
Regards,
------------------
Jose Marcenaro
Tercer Planeta - Argentina
http://www.tercerplaneta.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform