The IF node tells me that two strings that are strictly identical are not equal


I have to carry out scraping operations on behalf of a client, and therefore compare prices from 2 different sites. I managed to do this without too many problems.

However, I’m getting stuck on a fairly easy step. You’ll see that when I run my workflow, which I’ve taken care to share, the IF node says that the 2 prices aren’t equal, when in fact they are.

Can you help me?

Hey @arthurcorre,

This one took me a while, Looking at the data I would have assumed they are the same but as the node does a pretty good compare there must be something hidden.

For a bit of fun I used .hash() and that is where you can see that there is something else in the data.

The question now is… which character isn’t right, Well if we use .urlEncode() we can see an encoded view and that shows us something interesting…

The issue seems to be after the 1, A %20 is normally what you would expect to see for a space but the second value has %C2%A0 so in this case what you need to do is on the bottom item change it to {{ $json["supplier_price"].replace(' ', ' ') }} which will change the spaces to match and that then makes the values match.

It could be worth having something in the Set node before it or a code node to swap out any unexpected values, Personally I think I would maybe remove all empty / white space characters from both strings to play it safe.

Hopefully this helps and shows the steps I took in a way that makes sense.


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