How To get Variable name as value then store in in mysql dataabse

Hi All,

Nice to connect with people in this forum.
I would like to make data logger with flow below,
PLC (Data source) -> Node-Red -> MySql database.

I have store value to database with function below :
msg.topic = "INSERT INTO inject_testing (HOD_Ozone) VALUES (" + msg.payload.HOD_Ozone + ");";
return msg;

The next purpose is to get variable name as value and store it in database, for example the variable name is "HOD_Ozone" then I need to get "HOD_Ozone" store it in other variable to be able store in db.

Anyone have experience in this case ?

Thank you :slight_smile:

You can use object.entries() to get the key value pairs of an object.

Thank you @E1cid for your feedback, I will try it first

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