"TypeError: Cannot read property '0' of undefined" #444

I'm very beginner to Node-red and influx db. I was trying to return values from two functions say X & Y msg.payload1, msg.payload2 on to a different function Z which is below, so i can send these values to influx db with measurement "infy" and fields " BID & OFFER". So when i try to run both individually (ie, X to Z or Y to Z )doesnot give any error. but when try to run like below (both X,Y to > Z) gives error.

"TypeError: Cannot read property '0' of undefined"

If this is not the right way, please tell me if there is another. :slight_smile:

Almost every node in Node-RED has no memory of previous messages. They each just get a message do their thing and forget it.

So you cannot split a message do different things and then point the wires at one node and get it to work. As that node will see two separate messages.

You can either rework your flow to make it series rather than parallel, or use one of the techniques to combine messages.

These techniques are either to use the JOIN node (also look at the split node) or to use context values to store the output from one route that the other then picks up. (there an example of how to set and get context values in the docs about the function node and also in the cookbook (cookbook.nodered.org)

Thank you very much @ukmoose . i will look into the ways you suggested :slight_smile:

I wonder whether you would be better to feed the html nodes into Change nodes that set the topics to different values, then feeding those into a Join node set to generate key/value pairs. Then you would have both html results available in one message to pass to a single function node that does the work of X, Y and Z.