I have postede some question about issues with item and first(). If workflow has just a few nodes or is a simple workflow $node. item work fine but when your worflow is complex and has nodes like sql or mysql with multiplies rows returned and js code I am facing a lot of issues when try to use $node.item, and it forced to me to use $node.first() and that change all logic of my workflow.
Has anyone else faced the same issue?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Thanks for confirming my suspicious⊠I have a lot of nodes than changes the numbers of outputs, uff⊠I have to modify all my workflow :(. it is a shame thaty n8n be to weak handle previous items links
If I understood, what you said is that I have to try that all my nodes return just one output? If that, how handle when use sql or mysql nodes that make a. select * from table and ouput for this node are multiples rows�
For now i had to put all my mysql node in another workflow ans call then from my main workflow I know is not the best workaraound but for now is working. This is really weakness of N8N
Iâve faced this too, generally when I have some nodes that run for each item and others that only run once. I donât even bother using .item anymore and just use first() now, unless I know for sure the node outputs multiple items.
I feel like there should be better shorthand for accessing variables, like just as simple as $(âMy Nodeâ).fieldname , whereby if itâs a multi-item node it defaults to return the current item. You could still query for other indexed items by $(âMy Nodeâ)[i].fieldname .
For me, if thereâs a binary file itâs always in $binary.data anyway so having the additional complications of doing node.json.first(). seems like unnecessary bloat. You could simply always store the binary in $(âMy Nodeâ)._binary by reserving that special property.
That way, you treat each node as a simple json object or json list by default and it would be so much simpler.
My issue is thant when i use first in a multiple customer process first alway use the first client on the list and I need to use specifi Item process. My solution defnitly is not the best my be the worst but by know is working. This give me a chance to try your solution
Thanks
Another thing I have found is that if I consolidate all the items into a code node and then try and access âitemâ from a later node, I can no longer do itâI get a âbad matchingâ error.
In that case I have to wire a Set node in between an earlier node and the later node. Iâm not sure if thatâs the best way to do it, but I can confirm it does work.
âSorry for the way I wrote. I didnât realize. In my case, I had to do the same. I had to create several set nodes. Additionally, I had to move all the MySQL nodes that retrieve many rows into separate workflows and then call them from the main workflow. Thatâs what I did.â