Compare 2 payloads with function node

Hello,
I'm struggling with a function.
I have 2 payloads. Let's name them msg.payload.1 and msg.payload.2.

Now the function:

if (msg.payload.1==true && msg.payload.2==true){
msg.payload=false;
}else{
msg.payload=true;
}
return msg;

I cannot compare 2 undepended nodes without storing at least one of them inside context, right?
Or is there a way to do this?

See this article in the cookbook for an example of how to join messages into one object.

Or use one of the logic nodes, I use node-red-contrib-bool-gate

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.