edited
I'm getting a string variable from a plc in node red via node "s7", the variable should be inserted into a MySQL DB, through the function node I tried to create a "insert into" query but in the database the string appears undefined, I'm new on node red and I do not know what I was wrong with the query below
msg.topic =
"INSERT INTO S7_log(commessa_in_produzione) VALUES" +
('"+msg.payload.commessa_in_produzione+"')";
return msg;
Looking at the incoming message it appears you want to use the msg.payload.signal
field which will insert into the database the value "Commessa in produzione"
So the function should look like:
msg.topic =
"INSERT INTO S7_log(commessa_in_produzione) VALUES" +
('"+msg.payload.signal+"')";
return msg;