MsgPayload into a query on nodered-sqlite

An alternative to assembling text strings in function code is to use a simple template node – it uses “mustache syntax” to substitute variables into other text. So your example could be more simply written as:

insert into sensors (sensor_ID, sensor_Name) values (1, ’{{msg.payload}}’)

Set the template node to output plain text into the msg.topic field, and voila!

1 Like