this is the code that will find unique keys
# 🌎general
b
this is the code that will find unique keys
@delightful-mouse-32940 did this work for you?
d
Robert, sorry to take so long to respond you. I tried it a lot and It didn't work. I tried it in different ways and nothing happend
Here is me executing the code and nothing happens 🙁
I tried this way as well: function findUniqueKeys(array1, array2) { const set1 = new Set(array1); const set2 = new Set(array2); const uniqueToSet1 = array1.filter(key => !set2.has(key)); const uniqueToSet2 = array2.filter(key => !set1.has(key)); return uniqueToSet1.concat(uniqueToSet2); } const array1 = workflow.pedidoarray; const array2 = workflow.start; workflow.repetidoarray = findUniqueKeys(array1, array2);
I tried using my 1st variable as my 2nd one and my 2nd one as my 1st one... It didn't work I tried using another variable to store the result... and didn't work.
@bumpy-butcher-41910 for some reason nothing I tried worked (execute code generating, codes you guys sent me, codes from the internet, AI TASK...) And now this one worked I chose a different variable and did two tasks I wanted in one. (1st task: was to take those items that were in the first variable and weren't in the second one; 2nd task: find in my menu every item that matches with these items. Ex: if a persons just asks for a coke the bot has to ask the costumer which type of coke he/she wants, such as a can of coke, coke 1 liter or coke 2 liters). I'm doing in this way just to not have to use choices, because in my city there are some apps that does it in this ways and people don't really like it (don't ask me why lol), so I'm building a bot that takes orders by just asking like a real person and understanding what he/she wants
My variable number 1:
My variable number 2:
and the result:
(the rest of the code) just in case it's helpful to anyone. 🙂
I think it was a "bug" because one of the codes I tried before and didn't work now it's working and I'm using the same variables names than when I tried before
result:
The only one thing I did this time is that I created a new standard node and put a text in there lol
and it is now working... I'm just like what's going on here dude haha
But @bumpy-butcher-41910 you know what? when I tried your code in logs I saw the right results but for some reason the variable was empty and I was crazy "why this variable is empty my lord?? why?" and now right after lots of attempts and after I connected the node with a new one it gets working...
b
hmm
weird!
but at least it's working now haha