If expression on multiple items behaves strange

Describe the problem/error/question

I want to check incoming items with an if node to sort out the ones containing wrong data. Two problems arise:

  1. while switching items in the expression editor I get true and false values back from the expression but when I execute the node only false ones appear
  2. I cannot create the return value of the expression with the right type. Neither does (!isNaN(date)) produce a boolean not does return false or return “false” produce a string - confusing

What is the error message (if any)?

Item 0 returns false

Item 1 returns true

Output is all false??

Please share your workflow

Share the output returned by the last node

Expected output would be 2 false and 23 true output items.

Information on your n8n setup

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

Please see if this helps:

3 Likes

Well, thank you jabbson, that does work like a charm but why isn’t mine?

I just looked at it and was like - nope, I am not digging into that, let me rewrite :slight_smile:

I understand that but I would like to get an idea how the IIFE syntax resolves return values because I think that’s where the problem with my approach and I won’t be able to solve everything with one statement :slight_smile:

In case you need to do code, just do code - make it simple, readable and reusable:

2 Likes

Agreed, thanks :bouquet: !

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