Hi,
I am trying to reproduce a functionality I had many years ago in VB old program. basically, there, I had some expression written by the user involving some logic expression. the syntax for the user was something like:
"{Var1} <> 3 AND ({Var2} <5 OR {Var2} > 8)"
in the code I was looking for all the variables name inside {} and replace them with some values from a database, so for example if Var1 was 2 and Var2 was 4 , I could create at runtime the variable
"2 <> 3 AND (4 < 5 OR 4>8)"
at this point I was doing:
I am pretty sure there is somenthing like that in B4X but I could not find it. I would assume it should be in the RegEx but I need some guidance.
Can sameone help?
thanks!
I am trying to reproduce a functionality I had many years ago in VB old program. basically, there, I had some expression written by the user involving some logic expression. the syntax for the user was something like:
"{Var1} <> 3 AND ({Var2} <5 OR {Var2} > 8)"
in the code I was looking for all the variables name inside {} and replace them with some values from a database, so for example if Var1 was 2 and Var2 was 4 , I could create at runtime the variable
"2 <> 3 AND (4 < 5 OR 4>8)"
at this point I was doing:
B4X:
Set EvalEng = CreateObject("ScriptControl")
EvalEng.Language = "VBScript" 'JavaScript was another option
txt = ReplacedUserText 'in the example above "2<>3 AND (4<5 OR 4>8)"
Result = EvalEng.Eval(txt)
I am pretty sure there is somenthing like that in B4X but I could not find it. I would assume it should be in the RegEx but I need some guidance.
Can sameone help?
thanks!