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.

  1. Drag the Template node onto the canvas and wire it to the Function node.
  2. Double-click the Template node.
  3. Set the property to msg.topic.
  4. 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: ``

See also, Flow to Save Multiple Register Values and Marketplace MySQL Example.