# Perform AND function

**URL:** <https://discourse.nodered.org/t/perform-and-function/4371>\
**Category:** General\
**Created:** [29 October 2018 01:19 UTC](https://discourse.nodered.org/t/perform-and-function/4371 "2018-10-29T01:19:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpyandy](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cpyandy](https://discourse.nodered.org/u/cpyandy)\
**Post date:** [29 October 2018 01:19 UTC](https://discourse.nodered.org/t/perform-and-function/4371/1 "2018-10-29T01:19:52Z")

</div>

Hi all,

Sorry if this question is too basic for you guys, I am quite new to node red world.

I have two inputs, one from mqtt with payload "1", another input from dashboard switch which I have set the ON payload to "1" as well, is there a node to operate AND gate function which takes both inputs and only output if both input A & input B are equal to "1"?  
Alternatively, is there a function script performs the same outcome?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 October 2018 07:09 UTC](https://discourse.nodered.org/t/perform-and-function/4371/2 "2018-10-29T07:09:44Z")

</div>

[Flows.nodered.org](http://Flows.nodered.org) is always a good place to search to see what is available. I use node-red-contrib-bool-gate but there are several alternatives that you could use.

---

<div class="post-metadata">

**Author:** ![cpyandy](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cpyandy](https://discourse.nodered.org/u/cpyandy)\
**Post date:** [30 October 2018 02:55 UTC](https://discourse.nodered.org/t/perform-and-function/4371/3 "2018-10-30T02:55:54Z")

</div>

Thank you, I have resolved the issue with "and gate" together with "switch" node to pass through the "true" condition, then perform the remaining task.
