Integer Comparison Not Working Properly in "IF" Node

As shown in the screenshot below, the zero isn’t evaluated properly. Tried using parseInt() function to convert variable to integer, doesn’t work. Without parseInt, doesn’t work. Tried using regex match with 0, also doesn’t work.

Hi @BeStill :wave: Sorry to hear you’re running into this!

I’m not able to confirm this behaviour on 1.0.3 and playing around with the If node - we’d need some more information here in order to be able to test. Can you provide the information requested in the template, specifically:

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

If you could also provide some non-sensitive test data that we could use in JSON format, that would be helpful!

Hi @EmeraldHerald Thanks for you reply. Sorry for not providing all these version information.

  • n8n version: 0.236.1
  • Database: I believe it’s default SQLite cuz I installed via docker-compose
  • n8n EXECUTIONS_PROCESS setting: No configuration has done on this. Should be default.
  • Running n8n via: docker-compose
  • Operating System: Ubuntu 22.04.1

I will see if I could provide some test data later. Thanks for your help.

1 Like

Hello @EmeraldHerald . I have just upgraded the n8n version to 1.0, and the issue persist.

Is there any easy way I could share with you some test data? They are basically just HTTP request results from its (input node) and (2 node back) and (3 node back).

Even with the use of parseInt(), the equal zero is still not working.

As shown in the screenshot, the “0” in the bottom left corner outside of the expression box should be the input value already. But I’m not sure why this is still treated as not equal to zero.

Hi @BeStill - sorry to hear it’s still persisting, even after upgrading.

Is there some way you could provide example data similar to what you’re pulling from the HTTP Request node in JSON format (or even something I can put into a Set node), where it matches the structure of what you’re getting and trying to evaluate in the If node? As it stands, I’m not able to replicate this with either 0 (or a non-0), so I’m mainly curious on the format etc. so I can try to take a peek into what’s going on.

Obviously, please don’t provide any sensitive data :bowing_man: But perhaps there’s some dummy/example data you can provide in the same structure.

1 Like

Hi @EmeraldHerald

This is one of the data sample that I’m trying to evaluate. I would like to get the “abuseConfidenceScore” and see if it equals to 0.

"Data Center/Web Hosting/Transit",
"Google LLC",
"United States of America",
1 Like

Thanks for that data - no matter what I’m doing, I still can’t get this behaviour to match yours. Can you maybe provide an example workflow that is similar to your main workflow that wouldn’t require any credentials, etc. for testing? I’m suspecting maybe there’s some kind of trailing whitespace or the like causing this to not evaluate correctly, but as it stands I’m unfortunately not sure. :bowing_man:

I would love to provide the exact workflow for your reference. But all three request nodes require credential in order to make a successful request. But they don’t have anything special except just different fields to get from each node. Is there anything else you would recommend me to double check.

Workflow Concept: All I would like to do is that HTTP Request.score1 * 2 + HTTP Request.score2 == 0 AND HTTP == 0 AND HTTP Request2.xxxx.score3?

I just realised - It looks like you’re comparing “0” with 0, which is going to be false. Can you replace your condition with a number evaluation? That should work, and would also possibly explain why I couldn’t reproduce this :sweat_smile:


This is probably it. What a classic mistake :rofl: I’m testing this out. I will update the status once I fixed it.

Side track a little bit. I’m wondering for “Deduplicate”, I’m trying to deduplicate data based on a specific field if the input node has output. However, the input node does not always has output. This is giving me an error saying ERROR: '_id' field is missing from some input items. And it’s preventing me from activating the workflow. I was thinking adding a conditioning on if the previous node’s output exist. But there is no such feature. Do you have any experience on this?

1 Like

Hi @BeStill :wave:

It might make the workflow a bit confusing, but you could use another “If” node to check if the ID exists by looking for “Is not empty”. Something like this:

1 Like