# Automatic switch dashboard tab

**URL:** <https://discourse.nodered.org/t/automatic-switch-dashboard-tab/45791>\
**Category:** Dashboard\
**Created:** [17 May 2021 15:08 UTC](https://discourse.nodered.org/t/automatic-switch-dashboard-tab/45791 "2021-05-17T15:08:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![radjesth](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@radjesth](https://discourse.nodered.org/u/radjesth)\
**Post date:** [17 May 2021 15:08 UTC](https://discourse.nodered.org/t/automatic-switch-dashboard-tab/45791/1 "2021-05-17T15:08:24Z")

</div>

I have a payload  
payload: "true"

I want to check it with a switch to control a template for switching to another tab of my dashboard.  
The switch is like this  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/1370ad92cc2a74861ba44be67af7bde6adc24d1d.png)

I made a template with the following code  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/b/4bda8a39c69d7b142b58edeb7965d028635a39db.png)

the flow is  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fea763a64f6064b9ca78371cf78de9ffdd769e25.png)

If I put the code of the template into a button, the dashboard tab is displayed.  
So the code is ok....I think  
But with this flow I can not get it to work.

Thank you for helping

---

<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:** [17 May 2021 15:26 UTC](https://discourse.nodered.org/t/automatic-switch-dashboard-tab/45791/2 "2021-05-17T15:26:54Z")

</div>

You have told the switch node to test whether msg.payload contains the same value as msg.true does.

If the payload is a string "true" then the switch needs to be configured as

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

If it is a boolean true then use

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6e27a87625be0d161a5f10e31dd6428497feddc7.png)

Feed it into a debug node and you will see whether it is a string or boolean.

---

<div class="post-metadata">

**Author:** ![radjesth](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@radjesth](https://discourse.nodered.org/u/radjesth)\
**Post date:** [17 May 2021 15:39 UTC](https://discourse.nodered.org/t/automatic-switch-dashboard-tab/45791/3 "2021-05-17T15:39:13Z")

</div>

Thanks Colin  
It works  
At least I my template was ok  
Getting better everytime I talk to you guys  
Thanks

---

<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:** [16 June 2021 15:39 UTC](https://discourse.nodered.org/t/automatic-switch-dashboard-tab/45791/4 "2021-06-16T15:39:36Z")

</div>

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