How can I use the filter()
function in the Set node to remove duplicate records from a variable?
The filter function works as expected, but when I try to use it in the Set node, I receive null
instead of the expected result.
{{ $json["message"].match(/host=([^ ]+)/)[1].replace(/[<>]/g, '').split('|').filter((value, index, self) => {
return self.indexOf(value) === index;
}) }}
Information on your n8n setup
- n8n version: Version 0.225.2
- Database (default: SQLite): MySQL
- n8n EXECUTIONS_PROCESS setting (default: own, main): own
- Running n8n via (Docker, npm, n8n cloud, desktop app): : docker
- Operating system: Ubuntu 22.04.2 LTS