indiedev91
(Indie Dev 91)
November 2, 2022, 8:36am
1
So i was wondering if we can pass a operator in a variable just as a string or something and then use that variable to do different kind of condition
i know it doesn’t make any sense but i just wanted to try something for fun
for eg :- variable “opt” which holds value of “<” and there are two int variables that holds two different amount one is less then another
now in a if condition how can i just add thes three varibale
if(num1 opt num2)
Hi @indiedev91 ,
I believe we will not be able to convert a String value to an operator.
But for your case, if you do know the different types of operator that we could get in the Process or as request. Then we could use a Switch
Activity to map the operator to the proper case and then Execute the Operation/Create the Logic within that specific case.
Example Skeleton below :
indiedev91:
“opt
@indiedev91 You can use This in assign activity as opt = chr(60)
but it does not work as condition
indiedev91
(Indie Dev 91)
November 2, 2022, 10:34am
4
sorry i forget to mention is that the catch is we dont have to use any switch case
ppr
(Peter Preuss)
November 2, 2022, 10:40am
5
as mentioned by @supermanPunch we cannot bypass the compiler and its compilation step.
Have a look here:
we would modell as
CInt(x) > 5 and CInt(x) <= 8
A fully functionality like an EVAL() (javascript) we dont have Out-Of-The-Box
But lets loop in @StefanSchnell as maybe we can integrate an inline compilation / execution e.g. with Roslyn and build a EVAL feature by ourself
And also here:
[Bridge]
V8 is a JavaScript engine from Google which is used in the Chrome Browser, Node.js and other applications. It implements ECMAScript (the JavaScript standard) and WebAssembly .
ClearScript from Microsoft is a dotNET assembly that makes it easy to add this kind of scripting to your UiPath workflow, because it contains the V8 engine in its native assembly packages. Compared to the approach of using Node.js, described in my tutorial, here the V8 engine is used via ClearScript and the integ…
as maybe the offered eval() functionality can be used / integrated
system
(system)
Closed
November 5, 2022, 10:41am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.