No map function in Set/IF nodes

Describe the problem/error/question

I’m wondering why the map function is not working in the Set/IF and other nodes that use expressions.

What is the error message (if any)?

Invalid syntax :frowning:

Please share your workflow

What is the error message (if any)?

Expected result:
{{ $('Mock').all().map(x=>x.json.id) }} will return array of [1, 2, 3, 4]

Information on your n8n setup

  • n8n version: 1.8.2
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker

Hi @barn4k :wave: Can you explain a little bit more about what you’re trying to do / what kind of comparison you’re trying to make? In 1.9.0 I don’t get this error, but everything is returning false since it’s checking against an array vs single IDs against all the IDs :sweat_smile:


The same would be true if your expression was looking for contains:

1 Like

Hi @EmeraldHerald

You guys publish newer versions too often :grin:

Some array.map() manipulations in IF node simplifies the workflow. E.g. if I want to use array.includes() to check if something exists in the array, or use array.join() to convert it to string and perform substring searching.

Unfortunately, the latest docker image is only 1.8.2, and that functionality is not working there :frowning:

1 Like

Hi @barn4k - makes sense! While it’s not tagged as latest, you can pull 1.9.0 if you specify that version, but I suspect it’ll be latest soon :+1:

2 Likes

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