Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Type function is not smart enough
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00714883
Message ID:
00714958
Vues:
25
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform