Compare two variables in If Codition

Hi All,

I want to compare two variables(of type string), but it is not comparing it. Request to please help me in it.
Var1=“test” , Var2=“test”
I have tried the below

  1. Var1.Tostring=Var2.ToString --> it is not comparing the strings
  2. Var1.Tostring equals (Var2.ToString) --> it says end of expection required , so tried Var1.Tostring equals (“Var2.ToString”) --> cannot convert string to boolen.
    Thanks in Advance.

Hi @ppratz

Within If Activity write the condition as below

Var1.Equals(Var2)

This will definetly work

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi @Pratik_Wavhal

I have tried what you have mentioned but it says “Option strict on disallows implicit conversion from Boolean to string”

Hi @ppratz

It should 100% work if both the variables are of string type.

If it not working then check the variable type that are they String or not.
If they are not string then make them as string.

If then also the error is coming then if you can share your workflow here then i will understand exact what is the root cause.

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi @Pratik_Wavhal

But equals return the value as Boolean.

Hi @ppratz

I am taking about the variable types. I know it will return boolean.

Just try once the thing mention in the below SS :-
image

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

It is working Thanks

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