Save Multiple Register Values to MySQL
Estimated reading time: 1 minute
Expand on the basic template so that you can:
- Collect raw data from various PLC registers.
- Aggregate the data at regular intervals.
- Save the aggregated data for use by other applications.
Use the Template node to format the SQL statement to update the database with values that have been collected from multiple registers.
- Drag the Template node onto the canvas and wire it to the Function node.
- Double-click the Template node.
- Set the property to msg.topic.
- Enter the SQL statement to insert data into the database, click Done, and then click Save.
`INSERT INTO mytable(value1,value2,value3,value4) values (,,"","");`
Note: Depending on the MYSQL column types, certain formatting may be required. For example, if a column is VARCHAR, the following notation must be used: ``