IF node returns always false altough it seems to match

Hello there!

I’m just starting on n8n and got quite lost at the get go.

I’m simply trying to get through my first IF node but even we using a ‘Is not empty’ conditions, and there’s definitely a value, it goes to the FALSE branch.

Would somebody tell me what i’m missing ?


$item.json gets you an array (!) of the data of your last node

So $item.json[0].type should work

Or something along those lines. I am in my mobile so can’t try it out. But the point is with JSON you get an array so .type can’t work

1 Like

It’s a little hard to tell from the screenshot (you can share the entire workflow as code, and it will render as an interactive preview)… but - I think you have Value 1 set as a Fixed value, and it needs to be an Expression to use JavaScript in it. Basically right now you’re comparing two different hardcoded strings, which will always evaluate to False.

The Fixed/Expression toggle should be just above the text box (hidden until you hover over it), and then you should see a live preview of the expression evaluation below it when you have input data loaded in the left pane, as well.

It also looks like you toggled the Combine property to be an empty expression, which probably isn’t what you want. Since you only have a single condition it may not matter, but I’d set it back to fixed and “all” to keep the node config clean.

@pfiadDi’s note above may still be applicable, too - but sorting the input type is the first step.


Thanks both @pfiadDi and @craSH for your answers!

@pfiadDi in regard to .type it’s actually the name of the key, I just changed it to campaignType to avoid confusion. I did try with the index 0 but it wasn’t recognized.

But @craSH you pointed the issue on the Combine All! That was the blocker, it’s working perfectly. Should have been more carefull.

Thanks to both!


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