Issue in "IF conditions"

Hi dear @jan

As bellow image my “IF” result should be “false” while it goes “true”?!

Could you please help me to solve it or You think it is bug on 0.40 version of n8n?

Best regards;

Nothing on the IF-Node changed, so have no idea why it would have broke. I just tested and it works perfectly for me:

So I guess what is happening in your case is that you have multiple items. The first one has a value of “100” and will so end up in the false branch. The other one is having a value between 0 and 98 and ends up so in the true branch. That would probably be clearer if you would have at least left that information in the screenshot as it would have been important. Also, a screenshot of “false” being selected as output would make that clearer.

Anyway, that is the only explanation I would have and can think of unless you provide a workflow in which I can reproduce it. Then I would be happy to debug it.

It was so wired.
Like “Daddy Pig” I just restart n8n on my server (windows) and the problem is solved.
I’m so sorry.

Very strange! Glad to hear that it “solved itself” but would still like to know what was going on there! Especially because I am surprised that a restart would “repair” it especially because each workflow gets started in a totally new process anyway which is kind of a “restart” in itself.

Hi dear @jan
Unfortunately I have same problem again.

My second condition is true

Sadly can still not do anything without an example that I can reproduce the problem.

Are both of the same type? So are both strings or both numbers?
Because “750254796” is NOT 750254796

You right.
The problem was because of Webhook variables.

Now my question is that how can I send numbers as number via post feature in http request for my webhooks?

Great to hear that you found the problem!

Yes, if you use POST it should send numbers as numbers. Only when sending via the query-string like when doing a GET will everything be a string.

I run into problems with the IF node all the time, sometimes I can fix it just by adding an empty statement. And changing no logic, other times, there is the problem of comparing “number” to number

really this node could use a little work. If you get it working it works, but it is buggy. Big improvements would come from adding an option to push incoming values to integer.

Hey community - would this code fix number comparison issues?

{{$node[“split100into1”].context[“maxRunIndex”]}}

toInt({{$node[“split100into1”].context[“maxRunIndex”]}})

{{toInt($node[“split100into1”].context[“maxRunIndex”])}}

{{toInt({{$node[“split100into1”].context[“maxRunIndex”]}})}}

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        1760,
        500
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "additionalFields": {
          "tagid": "1610"
        }
      },
      "name": "ActiveCampaign",
      "type": "n8n-nodes-base.activeCampaign",
      "typeVersion": 1,
      "position": [
        2140,
        500
      ],
      "credentials": {
        "activeCampaignApi": {
          "id": "4",
          "name": "SellerShield AC"
        }
      }
    },
    {
      "parameters": {
        "workflowId": "15"
      },
      "name": "Execute Workflow1",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1,
      "position": [
        2700,
        500
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "=",
              "operation": "equal",
              "value2": "="
            },
            {
              "value1": "={{toInt($node[\"split100into1\"].context[\"currentRunIndex\"])}}",
              "operation": "equal",
              "value2": "={{$node[\"split100into1\"].context[\"maxRunIndex\"]}}\n\ntoInt({{$node[\"split100into1\"].context[\"maxRunIndex\"]}})\n\n{{toInt($node[\"split100into1\"].context[\"maxRunIndex\"])}}\n\n{{toInt({{$node[\"split100into1\"].context[\"maxRunIndex\"]}})}}"
            }
          ]
        },
        "combineOperation": "any"
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        2960,
        500
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "split100into1",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        2440,
        500
      ],
      "continueOnFail": true
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "ActiveCampaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ActiveCampaign": {
      "main": [
        [
          {
            "node": "split100into1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow1": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "ActiveCampaign",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "split100into1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "split100into1": {
      "main": [
        [
          {
            "node": "Execute Workflow1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}```
![Screen Shot 2022-05-27 at 5.11.05 PM|690x242](upload://pzN8nR7cFXIlc64Xk2cTzXR2U3w.png)
![Screen Shot 2022-05-27 at 5.14.49 PM|690x147](upload://AqWfR8mDgzupAl6XS9MSj1OZB6k.png)