Thats better.
OK, so proof that it works...
demo flow
[{"id":"60d1f2be.92678c","type":"inject","z":"b872cb4b.5a6448","name":"ok data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_RIGHT\":231, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_RIGHT\":241.1999969482422, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_LEFT\":241.1999969482422, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_RIGHT\":241.1999969482422, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_RIGHT\":220, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_LEFT\":220, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_RIGHT\":220, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_LEFT\":231, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_RIGHT\":231, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_RIGHT\":13.5, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_RIGHT\":13.5, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_LEFT\":13, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_LEFT\":220, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_LEFT\":231, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_LEFT\":13, \"ns=2;s=C08.C08$T.PreSeries Measurements.MasterDate\":\"05\\\\06\\\\2013\", \"ns=2;s=C08.C08$T.Codes.OperatorCode\":\"638998.opt\", \"ns=2;s=C08.C08$T.Codes.OrderCode\":\"MOK-091020-010$001\\r\", \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_LEFT\":241.22000122070312, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_RIGHT\":241.25999450683594, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_LEFT\":219.92999267578125, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_RIGHT\":220, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_LEFT\":231.10000610351562, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_RIGHT\":231.0800018310547, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_LEFT\":17.09000015258789, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_RIGHT\":17.020000457763672, \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_LEFT\":241.1999969482422, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_LEFT\":241.27000427246094, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_RIGHT\":241.3000030517578, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_RIGHT\":219.9600067138672, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_LEFT\":219.97999572753906, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_LEFT\":231.11000061035156, \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_RIGHT\":231.08999633789062}","payloadType":"json","x":330,"y":800,"wires":[["d746bfc8.ae662"]]},{"id":"d746bfc8.ae662","type":"function","z":"b872cb4b.5a6448","name":"Check data","func":"//test the payload object for nulls...\nvar hasNullOrUndefined = Object.entries(msg.payload).some(e => (e[1] == null || e[1] === ''));\n\n//check if we found nulls/undefined?\nif (hasNullOrUndefined) {\n let badEntries = Object.entries(msg.payload).filter(e => (e[1] == null || e[1] === ''))\n node.warn({ \"WARN\": \"Found null or empty values\", badEntries: badEntries});\n return null; //halt the msg (dont pass it to next node)\n}\nelse {\n return msg; //payload is ok - return the msg.\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":800,"wires":[["d367110e.ca1bf"]]},{"id":"d367110e.ca1bf","type":"debug","z":"b872cb4b.5a6448","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":800,"wires":[]},{"id":"b3b36d58.57ffe","type":"inject","z":"b872cb4b.5a6448","name":"bad data (null value)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_RIGHT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_RIGHT\":241.1999969482422,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_LEFT\":241.1999969482422,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_RIGHT\":241.1999969482422,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_RIGHT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_LEFT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_RIGHT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_LEFT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_RIGHT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_RIGHT\":13.5,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_RIGHT\":13.5,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_LEFT\":13,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_LEFT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_LEFT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_LEFT\":null,\"ns=2;s=C08.C08$T.PreSeries Measurements.MasterDate\":\"05\\\\06\\\\2013\",\"ns=2;s=C08.C08$T.Codes.OperatorCode\":\"638998.opt\",\"ns=2;s=C08.C08$T.Codes.OrderCode\":\"MOK-091020-010$001\\r\",\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_LEFT\":241.22000122070312,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_RIGHT\":241.25999450683594,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_LEFT\":219.92999267578125,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_RIGHT\":220,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_LEFT\":231.10000610351562,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_RIGHT\":231.0800018310547,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_LEFT\":17.09000015258789,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_RIGHT\":17.020000457763672,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_LEFT\":241.1999969482422,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_LEFT\":241.27000427246094,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_RIGHT\":241.3000030517578,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_RIGHT\":219.9600067138672,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_LEFT\":219.97999572753906,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_LEFT\":231.11000061035156,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_RIGHT\":231.08999633789062}","payloadType":"json","x":370,"y":840,"wires":[["d746bfc8.ae662"]]},{"id":"f267dc8b.f89b","type":"inject","z":"b872cb4b.5a6448","name":"bad data (empty string)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_RIGHT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_RIGHT\":241.1999969482422,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_LEFT\":241.1999969482422,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_RIGHT\":241.1999969482422,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_RIGHT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_LEFT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_RIGHT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_LEFT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_RIGHT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_RIGHT\":13.5,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_RIGHT\":13.5,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_LEFT\":13,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_LEFT\":220,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_LEFT\":231,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_LEFT\":123,\"ns=2;s=C08.C08$T.PreSeries Measurements.MasterDate\":\"05\\\\06\\\\2013\",\"ns=2;s=C08.C08$T.Codes.OperatorCode\":\"\",\"ns=2;s=C08.C08$T.Codes.OrderCode\":\"MOK-091020-010$001\\r\",\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_LEFT\":241.22000122070312,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_RIGHT\":241.25999450683594,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_LEFT\":219.92999267578125,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_RIGHT\":220,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_LEFT\":231.10000610351562,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_RIGHT\":231.0800018310547,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_LEFT\":17.09000015258789,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_RIGHT\":17.020000457763672,\"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_LEFT\":241.1999969482422,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_LEFT\":241.27000427246094,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_RIGHT\":241.3000030517578,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_RIGHT\":219.9600067138672,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_LEFT\":219.97999572753906,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_LEFT\":231.11000061035156,\"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_RIGHT\":231.08999633789062}","payloadType":"json","x":380,"y":880,"wires":[["d746bfc8.ae662"]]},{"id":"99c8d108.39792","type":"inject","z":"b872cb4b.5a6448","name":"bad data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":295,"y":920,"wires":[["bdc8210c.28e46"]],"l":false},{"id":"bdc8210c.28e46","type":"function","z":"b872cb4b.5a6448","name":"bad data (undefined)","func":"msg.payload = {\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_RIGHT\": 231,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_RIGHT\": 241.1999969482422,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_LEFT\": 241.1999969482422,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_2_PreSeries_RIGHT\": 241.1999969482422,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_RIGHT\": 220,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_LEFT\": 220,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_2_PreSeries_RIGHT\": 220,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_LEFT\": 231,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_2_PreSeries_RIGHT\": 231,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_RIGHT\": 13.5,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_RIGHT\": 13.5,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_2_PreSeries_LEFT\": 13,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureB_1_PreSeries_LEFT\": 220,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureC_1_PreSeries_LEFT\": 231,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureD_1_PreSeries_LEFT\": 123,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MasterDate\": \"05\\\\06\\\\2013\",\n \"ns=2;s=C08.C08$T.Codes.OperatorCode\": \"fred\",\n \"ns=2;s=C08.C08$T.Codes.OrderCode\": \"MOK-091020-010$001\\r\",\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_LEFT\": 241.22000122070312,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_1_Approval_RIGHT\": 241.25999450683594,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_LEFT\": 219.92999267578125,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_1_Approval_RIGHT\": 220,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_LEFT\": 231.10000610351562,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_1_Approval_RIGHT\": 231.0800018310547,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_LEFT\": 17.09000015258789,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureD_1_Approval_RIGHT\": 17.020000457763672,\n \"ns=2;s=C08.C08$T.PreSeries Measurements.MeasureA_1_PreSeries_LEFT\": 241.1999969482422,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_LEFT\": 241.27000427246094,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureA_2_Approval_RIGHT\": undefined,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_RIGHT\": 219.9600067138672,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureB_2_Approval_LEFT\": 219.97999572753906,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_LEFT\": 231.11000061035156,\n \"ns=2;s=C08.C08$T.Approval Measurements.MeasureC_2_Approval_RIGHT\": 231.08999633789062\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":920,"wires":[["d746bfc8.ae662"]]}]
the function...
//test the payload object for nulls...
var hasNullOrUndefined = Object.entries(msg.payload).some(e => (e[1] == null || e[1] === ''));
//check if we found nulls/undefined?
if (hasNullOrUndefined) {
let badEntries = Object.entries(msg.payload).filter(e => (e[1] == null || e[1] === ''))
node.warn({ "WARN": "Found null or empty values", badEntries: badEntries});
return null; //halt the msg (dont pass it to next node)
}
else {
return msg; //payload is ok - return the msg.
}
If you are still getting a message with an empty item, can you now capture the payload just like you did last time & reply with the "bad data"