This is actually a follow-up related to a previous post, but is a totally different question...
In an HTTP GET request, I grab the price of nickel (which is returned as a value that must be divided by 1), convert to lbs and then store in Influx, all via this function:
msg.payload = msg.payload.map(function (value) {
return {
measurement: "CommodityData",
fields: {
Ni_price: 1.0 /value.NI / 2204.623,
},
timestamp: new Date(value.date).valueOf()
};
});
return msg;
I have found that for reasons unknown, when grabbing historical data, it can return NaN (maybe it's a holiday or whatever). Influx does not like this, and displays:
"Error: invalid float value for field 'Ni_price': NaN"
I found at least two objects that were NaN.
Is there a quick and easy way to modify my function above to exclude any time Ni_price is NaN? Thanks in advance for any pointers.