Is there an AND node?

Guys,

I want/need to compare multiple context variables and dependent on the comparison do something else.

I could obviously do this in a function node - but it will probably end up quite messy - i was wondering if there is a node that lets you do this ?

I tried a search for an AND node - but thats not real successful !

Craig

Search for boolean-logic and you should find a few

node-red-contrib-bool-gate has both AND and OR nodes I have used, maybe those are what you looking for?

Just use two or more switch nodes in a row.

3 Likes

Thanks Guys for the suggestions - will check them out.

I have in the past used multiple switch nodes - but it rapidly becomes messy - its then a tradeoff between coming back in a year and trying to work out what a function node is doing or working through a very large canvas

Will mess around some more with the gate suggestions

Craig

If you are testing properties in one message then you can do this with one Switch node by putting the logic statement as the property to be tested, using JSONata. So, for example this will test whether both payload.a and payload.b are true.

If the properties are in different messages then I suggest node-red-contrib-bool-gate as already suggested above, I think.

Thanks Colin.

I still have not quite wrapped my head (at all !) around Jsonata yet - i stand in awe of you guys when you can do this (seemingly without thinking !)

Still playing around with some of the Boolean nodes - i like Boolean-Ultimate at the moment and am trying to make that work

Craig

I'll let you into a secret, I had to go and test this before posting to make sure it would work. Don't tell anyone or my street cred will go way down.

2 Likes

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