Hello.
Can someone pinpoint me what am i missing in the following scenario?
I have a javascript code that runs correctly.
let j=[
{
"DirName": "mour"
},
{
"DirName": "dmyk"
},
{
"DirName": "oiad"
},
{
"DirName": "deko"
},
{
"DirName": "dvia"
}
];
let values=j.reduce((o,a)=>{
let ini=[];
ini.push("(", "NULL", 5, a.DirName, "NOW", ")");
o.push(ini);
return o;
},[]);
let forInsert = values.join(', ');
let finalInsert = forInsert.replace(/\(\,/g, "(").replace(/\,\)/g, ")");
console.log(finalInsert);
The result is
(NULL,5,mour,NOW), (NULL,5,dmyk,NOW), (NULL,5,oiad,NOW), (NULL,5,deko,NOW), (NULL,5,dvia,NOW)
I want to replicate it in n8n that but i think i am missing something minor and i get stuck.
The code is
If you run it the result is
(NULL,5,,NOW), (NULL,5,,NOW), (NULL,5,,NOW), (NULL,5,,NOW), (NULL,5,,NOW)
It misses the DirName.
What am i doing wrong?