# Switch not working

**URL:** <https://discourse.nodered.org/t/switch-not-working/50034>\
**Category:** General\
**Created:** [23 August 2021 03:38 UTC](https://discourse.nodered.org/t/switch-not-working/50034 "2021-08-23T03:38:48Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndz](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@ndz](https://discourse.nodered.org/u/ndz)\
**Post date:** [23 August 2021 03:38 UTC](https://discourse.nodered.org/t/switch-not-working/50034/1 "2021-08-23T03:38:48Z")

</div>

Hello guys, can someone tell me whats wrong with this switch I am using to create a telegram chatbot?

I would send you the nodes but i cant expose my telegram bot token so i will send some prints instead

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/a/2ae7fdaa57772ff05faf4360596dc2cfd3cf54ab.png)

this is my flow, the problem is the bot just stops before it enters in the "submenu-1" node, like my switch its not working at all

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c7bde78925ceffcf64a6ddaa7c07d2afe72bdd3e.png)

that its mine switch node and im using "== 1", witch is the value of my payload.content at the moment  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e4f97e0768c191df45f74bb16a4a633150f7d294.png)

Idk if im doing something stupid or its a bug, so if anyone could help i woul appreciate

ps: sorry for my bad english

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 03:43 UTC](https://discourse.nodered.org/t/switch-not-working/50034/2 "2021-08-23T03:43:55Z")

</div>

> [@ndz](#):
>
> im using "== 1",

But you have == **string** selected. Are you sure your content is not a number? _(although it looks like a string with the "1")_ 🤔

---

<div class="post-metadata">

**Author:** ![ndz](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@ndz](https://discourse.nodered.org/u/ndz)\
**Post date:** [23 August 2021 03:49 UTC](https://discourse.nodered.org/t/switch-not-working/50034/3 "2021-08-23T03:49:10Z")

</div>

i try to use number but nothing changes, and im pretty sure that its a string 🤔

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 03:50 UTC](https://discourse.nodered.org/t/switch-not-working/50034/4 "2021-08-23T03:50:02Z")

</div>

Toss in some `debug` nodes to see what is happening

---

<div class="post-metadata">

**Author:** ![ndz](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@ndz](https://discourse.nodered.org/u/ndz)\
**Post date:** [23 August 2021 03:52 UTC](https://discourse.nodered.org/t/switch-not-working/50034/5 "2021-08-23T03:52:29Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c099914ae7d58cfeb71670b977fc8203514df0b3.png)

thats what the debug returns

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 04:01 UTC](https://discourse.nodered.org/t/switch-not-working/50034/6 "2021-08-23T04:01:14Z")

</div>

I set up a simple test... you need to use` == "1"`,` == "2"`, etc... for an incoming string

---

<div class="post-metadata">

**Author:** ![ndz](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@ndz](https://discourse.nodered.org/u/ndz)\
**Post date:** [23 August 2021 04:03 UTC](https://discourse.nodered.org/t/switch-not-working/50034/7 "2021-08-23T04:03:27Z")

</div>

like this?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/3/9377b33091c4384d2518bf5eb49e3897cbf2f273.png)

i tried, it does not work

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 04:06 UTC](https://discourse.nodered.org/t/switch-not-working/50034/8 "2021-08-23T04:06:10Z")

</div>

Hmm, works for me...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/0/20a507b943e783bf636dc27cc067c33af0e093a0.png)

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

---

<div class="post-metadata">

**Author:** ![ndz](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@ndz](https://discourse.nodered.org/u/ndz)\
**Post date:** [23 August 2021 04:10 UTC](https://discourse.nodered.org/t/switch-not-working/50034/9 "2021-08-23T04:10:20Z")

</div>

i think its entering in the switch option because I got a return in the debug node, but it doesn't activate my "submenu-1" node idk why...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/116c537535c4306b062292bb748e08b516d6f7c9.png)

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 04:12 UTC](https://discourse.nodered.org/t/switch-not-working/50034/10 "2021-08-23T04:12:38Z")

</div>

Put a debug after the submenu... ~~you can also set the debug to output **complete message object** to see everything that is happening.~~ You are doing that 😊

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 04:20 UTC](https://discourse.nodered.org/t/switch-not-working/50034/11 "2021-08-23T04:20:00Z")

</div>

> [@ndz](#):
>
> but it doesn't activate my "submenu-1" node

Will a `"1"` activate it? (I think that is what the switch is passing on), or does it expect a `1`

---

<div class="post-metadata">

**Author:** ![ndz](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@ndz](https://discourse.nodered.org/u/ndz)\
**Post date:** [23 August 2021 04:22 UTC](https://discourse.nodered.org/t/switch-not-working/50034/12 "2021-08-23T04:22:19Z")

</div>

I did it!! thanks for the help, it was missing another "telegram sender" to work, but now its ok 😀

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [23 August 2021 04:23 UTC](https://discourse.nodered.org/t/switch-not-working/50034/13 "2021-08-23T04:23:24Z")

</div>

Hah... wild 🦆 chase

---

<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:** [25 August 2021 09:13 UTC](https://discourse.nodered.org/t/switch-not-working/50034/14 "2021-08-25T09:13:35Z")

</div>

> [@Gunner](#):
>
> wild 🦆 chase

That is a duck 🙂

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [25 August 2021 19:46 UTC](https://discourse.nodered.org/t/switch-not-working/50034/15 "2021-08-25T19:46:51Z")

</div>

Just cuz it looks like a duck and waddles like a duck doesn't mean it isn't that darn goose incognito... so shoot it anyhow 🔫_(and just like someone put in a water pistol for gun emoticon, they forgot the goose 😛 )_

---

<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:** [24 October 2021 19:47 UTC](https://discourse.nodered.org/t/switch-not-working/50034/16 "2021-10-24T19:47:08Z")

</div>

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