HI, All you NR superstars!! I really need urgent help on a seems to be something simple that I of some reason just can't get to work after 3 days of trying, and a LOT of Reading !!!
I attempting to pass data from a UI Form from the dashboard into an SQLite dB.
Hardware: Raspberry PI 4 / Node-Red v 1.0.6
So far I have successfully
- created Dashboard with the relevant form to add a " new user" called "users"
- I have installed SQLite and have created the DB with the relevant table for the user as "users" ( Confirmed)
The Issue - I have tried to pass the [ Form ] data to a [ function ] node and link it to the [ SQLite ] node as per the instructions founded here on these forums.
Unfortunately, regardless of the millions of attemps in all different ways, forms, and methods, I just don't seem to get any values to the Sqlite node from the function node.
Can some PLEASE be so kind and inform me what I am doing wrong, I'm sure its something simple, I just don't seem to identify the issue.
here is my Function node code that's playing dead :
var users="user_name:Johnny,User_surname:Bravo,user_pin:3333,user_acc_level:1,user_acc_code:1";
//extract elements from data
var user_name=payload.user_name;
var user_surname=payload.User_surname;
var user_pin=payload.user_pin;
var user_acc_level=payload.user_acc_level;
var user_acc_code=payload.user_acc_code;
//create SQL command
msg="(user_name,User_surname,user_pin,user_acc_level,user_acc_code) values("+",\'"+user_name +"\',\'"+User_surname +"\'," + user_pin + "," + user_acc_level +"," + user_acc_code +")";
var topic="INSERT INTO USERS" +msg;
var msg1={}; //create new msg object
//The SQlite node expects the command in the topic field
msg1.topic=topic;
return msg1;
and this is the "debug" values ( complete msg object) from the incoming form data to the function node
ty7/3/2020, 4:33:49 PMnode: 8d87e409.564458
users : msg : Object
object
payload: object
user_name: "Jac"
User_surname: "McDonald"
user_pin: 9874
user_acc_level: 5
user_acc_code: 1
topic: "users"
socketid: "TbsdLj_kQzyESfbBAAAH"
_msgid: "d16e70ab.d3361"pe or paste code here
Your fast responses will be greatly appreciated to get this thing to work asap. thanks in advance !!