# Simple logic question

**URL:** <https://discourse.nodered.org/t/simple-logic-question/29227>\
**Category:** General\
**Created:** [30 June 2020 12:36 UTC](https://discourse.nodered.org/t/simple-logic-question/29227 "2020-06-30T12:36:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [30 June 2020 12:36 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/1 "2020-06-30T12:36:41Z")

</div>

Hi all,

how can I check several payloads in a single switch node?

Sample: i have a tradfri remote controller with 5 buttons. when i click the central button, then i get a value (empty), when i click top button (payload.stepmode 1 or 0) or left/right button (payload.value 1 or 0) then i get different payload-values.

This works, but i think, that is possible in 1x node and not 3 nodes:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/7/d72c29d1a115e7f2e8407f0cce5d57eba9804bf8.png)

---

<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:** [30 June 2020 14:14 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/2 "2020-06-30T14:14:00Z")

</div>

Can you define in words exactly what conditions you are trying to test for for each flow going out ?

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [30 June 2020 14:34 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/3 "2020-06-30T14:34:42Z")

</div>

Hi Colin!

yes sure...

if payload.stepmode = 0 then ..  
if payload.stepmode = 1 then...  
if payload.value = 257 then..  
if payload.value = 256 then..  
if payload = empty then ...

is this in 1 switch node possible or i need a function node? the flow in the screenshot is function, but i think, is not the right way...

---

<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:** [30 June 2020 14:48 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/4 "2020-06-30T14:48:59Z")

</div>

What about the combinations of the first four? stepmode 0 and value 257 vs stepmode 0 and value 256 for example.

Edit - also what about other values of value and stepmode?

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [30 June 2020 15:11 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/5 "2020-06-30T15:11:51Z")

</div>

In first step, is enough for me, when not combinations exist. it is only a sample.

---

<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:** [30 June 2020 15:21 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/6 "2020-06-30T15:21:44Z")

</div>

I think you will either have to use multiple switch nodes or use a function node. However it may depend on what you want to do after deciding which conditions are satisfied. If you just need to set values for example it may be possible in a Change node, but if you need to head off down different flow paths then you need a Function or Change nodes I think.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [30 June 2020 22:02 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/7 "2020-06-30T22:02:23Z")

</div>

I suggest sticking a `debug` node on the output of the first node and making it show the **entire message**.

Then press a few buttons to show people what you are getting. I think that will remove a lot of confusion.

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [1 July 2020 06:15 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/8 "2020-07-01T06:15:34Z")

</div>

Read my first Posting. I get the payload values in the switches (Screenshot).

It is not important... i closed the thread.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 July 2020 06:25 UTC](https://discourse.nodered.org/t/simple-logic-question/29227/9 "2020-07-15T06:25:26Z")

</div>

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