Dear all,
I am a beginer of UiPath.
In my current training case of UiPath robot, I am trying the following steps:
Read one text from IE browser into a variable v1.
Read one text from one Excel file into a variable v2.
Compare these two variables by using FlowDecision.
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.
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.
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.
@hk803592
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.
@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.
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?