Condition check from string

i have an if condition ina string. how to check it.

Example: assign str_check= “if n1>n2,1,2”

i want to the above condition in if statement.

Is it possible to do

Thank you


In the condition field give n1>n2

In then use assign and give the value 1 to str_check

In else give value 2


thanks to the reply, i knew what you are trying to explain, but my case is different.
i gave the sample one, i have the condition in a string variable which was arrived from source, I need to check that string


What you need to check in that string?..

Do you need to extract condition feom that?

Or you want to check if string contains some value?

Str.contains(value) can be used to check if it contains something…


condition itself is a string


Then use split activity to split on comma and extract the first value…then it would contain only the condition details.


This would give only the condition…


even then it will be a string, how will you validate the condition


There can be any condition and symbol?

You can use a switch case if its only lessthan greater than and equals symbols and then verify the condition by splitting again on the identified operator…

Everything can be done until you know what are all the possible ways that you can get the condition


Hi @Naga_Abhishek_Reddy_Chepp,
Cloud you please elaborate more about your question as I did not get your point you use < or > symbol in your condition while you variable is String type did you ask how to change from string to integer or you need something else also if available to share with us the error from activity it will be better.
if you ask how to change from string to Integer you can find your answer in below URL.

There isn’t a simple way to evaluate a condition in string form, without using external scripts that includes a function to return the result of the string condition.

**There is an EVAL() function, which Peter’s post directs you toward, so you can check that out above.

As an alternative to that, however, there are some workarounds to handle your problem. For example, you could use a Regex pattern to strip out the condition, then, and else parts, and implement it using built-in vb or UiPath activities.

Or, have the source that contains the condition in string form changed so that the evaluation is made through the UiPath automation rather than by using a hardcoded string.

thanks all, did some work arounds and got the solution.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.