Hi, am very new to node-red and js .. getting the following from an mqtt input and trying to access the valuse in a js function to create an sql statment to post them into sqlite database with the same field names.
this page in the docs explains how you can use the Debug sidebar to identify the path to any message element: Working with messages : Node-RED
It also helps you understand if msg.payload is a JSON String (where you can't directly access the individual properties inside it) or if it has already been parsed to a JavaScript Object where you can access its contents.
Worth a read through to see how that can help you understand what you've got.
It should look a whole lot different that what is shown.
Try this:
To the left of the 1 key is the key which I can't show here. It is basically very similar to '
Press it 3 times. Press enter. Paste the stuff. Press enter. Press the afore mentioned key again 3 times.
Have a play with the Template node (not ui-template). That provides a good way of building a query string from a number of variables. I am assuming you know the query string you are trying to build.
yes very much so, just having an issue writing the js, to read the key values into the sql statment as values. was / am using the js function node .. had not thought about the template node.
oh yes .. always debug first. Almost got my js function working .. right now it is giving me the key names not the values in my out put .. grrr so damn close