Hello,
i would like to know how i can block a complete message in a function node.(Not with other nodes)
ATM i use: msg.payload = {};
but with this method i get only an empty payload.
Is there a easy way to block the full message?
Greetings
Chorum
this will halt flow of message...
return null;
Remove the return msg altogether in the function node.
Mhmm i think i post my Code:
var Check = 0;
Check = global.get("boxlivescreen");
if (Check == 17) {
msg.payload.MQTTBoxname = "W16";
msg = msg.payload;
node.status({fill:"green",shape:"dot",text:Check})
} else {
msg.payload = {};
node.status({fill:"red",shape:"dot",text:Check})
}
return msg;
return null would be nice but with msg = null; the function node blocks everything, also when it should let pass.
You asked ...
I said...
If you want conditional blockage - you should ask.
Is this what you are trying to achieve...
var Check = 0;
Check = global.get("boxlivescreen");
if (Check == 17) {
msg.payload.MQTTBoxname = "W16";
msg = msg.payload;
node.status({fill:"green",shape:"dot",text:Check})
} else {
node.status({fill:"red",shape:"dot",text:Check})
return null; //halt flow after updating status
}
return msg;
Sorry next time will discribe my wishes more clearly
that works fine!
Didnt know that i can use the return in that way.
Thank you!