SQLite Error - Exporting data to sql database

I have the following code in Node Red:
msg = {
"topic": "INSERT INTO TestTable (PV, SV) values (" + "'" + parseFloat(flow.get("PV") / 10) + "," + parseFloat(flow.get("SV")) + "')",
}
return msg;

However, I am getting the following error: "Error: SQLITE_ERROR: 1 values for 2 columns". Both PV and SV are valid values which I have verified by outputting both individually. What can I do?

Feed the output of your function into a debug node set to output complete message and see what the topic is set to.

I figured that error out. I am not stuck on a new error. Here is my corrected code:
msg = {
"topic": "INSERT INTO TestTable (PV, SV) values (" + "'" + parseFloat(flow.get("PV") / 10) + "'" + parseFloat(flow.get("SV") / 10) +",')"
}
return msg;

and here is the error: "Error: SQLITE_ERROR: near "20.3": syntax error". where 20.3 is the value of SV.

Any ideas??

My advise now is exactly the same as last time.

2 Likes

In your definition of the table, what 'TYPE's did you define for PV and PS

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