Facing issues in looping through list of dicts in n8n for mysql

I was trying to get some data from a chatbot as a list of dict and update it to the database after the data is collected from the api I was able to loop through each and every elements and update it to the database. After that I had to do a different db update and again access the data that is collected from the api and do a database insertion.But this time only the first element in the list is inserting.

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:1.21.1
  • **Database (default: SQLite):SQLite
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):main
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):n8n cloud
  • **Operating system: Windows

Hey @Abin_Jilson,

How many items does each node output? It could be that using a Loop Over Items node after the Chat bot node is the way to handle this so it only deals with one item at a time instead of trying to be smart. We tend to run the node based on the amount of inputs so if Create Request was only returning one item we would only run the last MySQL node once.

1 Like

Hi @Jon , Thanks for replying .The Chat bot node is returning 74 items. I was able to insert all those items into Insert Into t_chatbot_input table node. Rest of the nodes are only returning 1 item. The key point is I was trying to use the same output from t_chatbot_input table node for updating the last MySQL node.

Hey @Abin_Jilson,

In that case what I would do is add the Loop Over items node after the first MySQL node that should then allow you to work around the way we loop over data in nodes.