I have a node sending data from a energy-meter.
The data that i recieve is delivered like this.
Delivery 1: an array of data,
Delivery 2. a given value (1 line of the array)
Delivery 3: a given value (1 line of the array)
I am using a function node to extract a certain value frome the array:
var o = msg.payload
msg.payload = o.volt_L3 / 10
return msg;
The issue is sthat "delivery nr 2 & 3" does not have the array, therfore the results is "NaN".
The value i try to extract is passed on to a smart-house-system. The "NaN" value is therfore translated in to "0" in the smart-house-system.
What is best-pracsis for only extracting data from the msg. that has the full array, and skipp/not pass on the data from the msg. that doesnt have the full array.
That will not work if msg.payload is an array. Perhaps you mean a javascript object. I think you had better feed the messages into a debug node and show us what you have actually got.
Maybe i was a bit unclear.. in my example i would like to only extra the value corresponding to: volt_L1.
If i use a change node to "extract" the value, the messeages that dosent have the value for volt_L1 returnes as "undefined".