Unable to insert all data values to my database

Hello!
I try to insert data from json file generated from a http but just the last value inserted.
my flow and my json file format is presented as bellow.

The first iteration of the loop will move the array value to msg1 then insert msg1 in to the msg.topic with the rest of the sql statement.
The second iteration of the loop will insert the next array value to msg1 then insert msg1 in to the msg.topic with the rest of the sql statement.
The third iteration of the loop will insert the next array value to msg1 then insert msg1 in to the msg.topic with the rest of the sql statement.
.
.
.
The last iteration of the loop will insert the last array value to msg1 then insert msg1 in to the msg.topic with the rest of the sql statement.

the loop ends and you send out the message and the topic contains only the last value from the array.

Take a few minutes to read https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously and you should find your solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.