Comparing two string variables in FlowDecision's condition

Dear all,
I am a beginer of UiPath.
In my current training case of UiPath robot, I am trying the following steps:

  1. Read one text from IE browser into a variable v1.
  2. Read one text from one Excel file into a variable v2.
  3. Compare these two variables by using FlowDecision.
  4. Do something according to the comparison result.
    Now, step 1) and 2) are OK. Step 3) encountered a problem that is confusing.
    Two varaibles with same values are always judged as “not equal”.

I confirmed their values in log messages. They are the same.
And I tried “Trim”, “Contains”, “Equals” upon v1 and v2…All of them don’t work.
Expressions like “v1=v2”, “v1.Trim.Equals(v2.Trim)”, “v1.Trim.Contains(v2.Trim)”, “v1.ToString()=v2.ToString()”…don’t work.
For v1 and v2, I tried “String” or “GenericValue” types.

And, the text values are not ANSI characters but Chinese or Japanese ones. e.g., “北海道”.

Could anyone please give any help? Thanks in advance.

2019/09/11 17:50 (UTC+8 Beijing Time) Latest Information:

Everybody, thanks for all of your help. After several hours struggling with this issue, the reason was found.
The string from IE starts with a utf-8 BOM header(0xEFBBBF) while the one from Excel doesn’t. So the comparsion always failed. Both “=” and “Equals()” can’t work in this scenario.
As a temp workaround, I used “v2.Contains(v1)” currently. (v2 has BOM so it is bigger than v1).

In UiPath, I don’t know how to remove the BOM header easily yet.
If you have some information, please let me know. Thanks again.

I assume that you have taken both the variables as string. And then try .trim.tolower on both and then compare the string

Hi @michael

What’s the type of the variables? Are those in generic type?

Try the below and let know whether it works…


1 Like

Hi, @Lahiru.Fernando,
Currently, they are of GenericValue type. I tried "v1.ToString.Equals(v2.ToString). Still not working…:<
Here are some log messages: (I placed “<”, “>” around the values.)
v1: <北海道>
v2: <北海道>
‘北海道’ <> ‘北海道’ //got from the false branch.

Hi, hk803592,
They are of GenericValue type now.

Try changing them to string.

And first try with any english text and check if it works?
Then go for your words

Hi, @hk803592,
Good idea. I will try with ANSI text first. Thanks a lot.

I think you may need to do this as well…

  1. Convert the variable to string
  2. While comparing, you will need to do convert them to upper or lower case as well!!!

For language comparison, I am curious that if that will work or not :open_mouth:

Please do share your finding :slight_smile:

Hi @michael
Can you show the Screenshot of your workflow with condition and variable values?

I reset the variable type ton “String”.
And I tried some ANSI text. It works well.
But String type is still not working for non-ANSI characters.

1 Like

Thanks for your idea. I tried again but it doesn’t work.

Here are the screenshots:
“p_name” is the “v1”, province_name is the “v2”.


@michael Everything seems Fine bro. just try to check manually with that values inserting in to two variables. it should work because you are getting same values.

@jitendra_123 @Lahiru.Fernando
Hi, everybody, I found some hint about this issue.

  1. comapring v1 to v2: false.
  2. comparing v1 to “北海道”, true.
  3. comparing v2 to “北海道”, false.
    It seems the underlying value of v2(from IE) is different from what we see by message box as below.
    I am going to write that value to some binary file but uipath seems not able to operate binary file. Right?

Hi, @Lahiru.Fernando @jitendra_123,
I updated this post with latest information. Please check it above.

Hi, @hk803592, @Shubham_Varshney,
I updated this post with latest information. Please check it above.