If node is true and false in one execution

Hi guys,

I have a problem with the if node.

If I perform a data-merge over a function after a “split in batch” and then check the variable “isDev” from the “.env”-function defined before (before the split in batch) for “true” after the batch I get true AND false in one pass. For checkup: Function2 has a console.log($node[".env"].json["isDev"]);

Is this a bug or a feature?

For a better understanding I have built a pseudo-workflow.

The workflow was executed on version 0.95.1

In the real Zenario a http request with different configurations is executed within the “Split in Batch”. The result should and will be summarized afterwards.

Hey I also had a problem with If statement did you check for whitespace? I kept getting false and then I copied the value for the bool in " edit expression" and noticed there was a space after Yes. When I put the space in the evaluation it returned true like expected. I did not look through your code yet but will soon. So it was "Yes " instead of “Yes” in the result box.

Thx for sharing :slight_smile:
For me it might not have been the problem with whitespaces, but much more the understanding of the batch processing of the results.
If multiple objects are returned, each one is checked. Thus in the result also an IF node can be true AND false. But NEVER for the same line/object.

Hi Guys,
Is this topic still open, facing something similar,

As you can see in below screenshot the output is there for false only but still the true node is also executed [screenshot above]

Not sure what I am doing wrong, there are similar cases in other workflows also but they work well.

Hey @mayanktiwari,

It doesn’t look like the true branch is being triggered from your screenshot it is instead the node after it, Without seeing the full workflow I suspect you have a merge node somewhere along that path which will always expect 2 inputs to run and it doesn’t have one it will go back to a point that it can find some data.

As @jon said that is currently expected behavior. Is, however, planned to change that in the future, probably with the upcoming n8n version 1.0. Here is already a PR:

Yes actually using Merge node which is causing this issue.

New version n8n@1.0.5 got released which includes the GitHub PR 4238.