Hi,
I'm trying to put a string together to send to google sheets as a msg.cell.
I've got return from google sheets working and I can use a inject node to pick and choose cells to get.
I'm trying to automate it now and I've got two values: msg.currentitem and msg.plusthree
I want to take those two values and combine them like this Sheet1!A(msg.currentitem):E(msg.plusthree)
I tried the string node and appending it but getting a undefined error in my debug node for the section where I'm referencing the msg items. Also tried a basic function and it gives me the same error. Also at the moment the string node gets triggered twice giving me the following output:
How would I use two different incoming msg payloads then as part of the formatting? Tried: BTC!A{{msg.currentitem}}:E{{msg.plusthree}}
But it prints it without the messages. Also it still activates twice cause the two values are calculated separately.
I think a function might be a better node to use. I just have no experience with using it or the syntax. The idea is gets a number read in from a csv. Then it needs to stitch the following together:
BTC!A(csv number):E(csv number + 3)
If I can figure out how to do the function node I won't have two messages to join together. Just using nodes to do basic math and then combining it again at the moment.
Then don't branch flows as that creates multiple messages. Wire in nodes series and store the values in different part of msg so as not to overwrite previous values.
Lastly, see the node-red docs regarding writing functions and using context.
Ps,
I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour.
There a few gems in that playlist that will help it all just "click" for you. for example, the copy path button on the debug output.
Refactored most of my flows now based off that playlist. Also changed things around to now periodically update from the google sheets but also store a local csv. The thing I'm struggling with now is referencing a certain value from the csv as it's a big array(?) of data. Basically I want to go and reference a certain col and then a amount that I've set to a global value but not having any luck with change nodes and understanding how I'm going to filter it.
The last one is where I'm stuck now. Basically just need to get a value from col 4 and a row that's referenced by a global value.
I've put all of my tcp connections on a separate flow to prevent them from constantly reconnecting whenever I deploy changes.