# Switch node - multiple values in same conditions

**URL:** <https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019>\
**Category:** General\
**Created:** [3 November 2022 12:27 UTC](https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019 "2022-11-03T12:27:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [3 November 2022 12:27 UTC](https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019/1 "2022-11-03T12:27:02Z")

</div>

Hi can someone help me create a switch node with multiple values like  
for example if msg.payload can push 1,2,5,10 then switch node should run two conditions with == for 1,2,5,10 and != for 1,2,5,10  
how do i use multiple values in one condition

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d5d891ca2f0df1acb39f988ed4a4a08eb5e132a9.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [3 November 2022 13:06 UTC](https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019/2 "2022-11-03T13:06:05Z")

</div>

Have you tried...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/886b016253b0fe70147bb6505650d3e9a3dd5c57.png)

or

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/544cfeba6dc515ba96ce004c62403d2a8753b567.png)

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 November 2022 17:06 UTC](https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019/3 "2022-11-06T17:06:15Z")

</div>

thanks second example worked

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [7 November 2022 11:18 UTC](https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019/4 "2022-11-07T11:18:47Z")

</div>

I would also like to thank you. I would never have thought of using JSONata as the selection property, didn't even realise you could. 🤣

It certainly makes things lot neater

---

<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:** [21 November 2022 11:18 UTC](https://discourse.nodered.org/t/switch-node-multiple-values-in-same-conditions/70019/5 "2022-11-21T11:18:53Z")

</div>

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