# Dashboard ui\_control: show / enable Tabs using variable not hard-coded

**URL:** <https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577>\
**Category:** General\
**Created:** [23 July 2020 03:37 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577 "2020-07-23T03:37:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulkeates](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paulkeates](https://discourse.nodered.org/u/paulkeates)\
**Post date:** [23 July 2020 03:37 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577/1 "2020-07-23T03:37:00Z")

</div>

Hi,

Windows 10. Node-RED 1.1.2. Dashboard 2.22.1

I have a flow that works very well. It uses Dashboard to display multiple Tabs each with a unique name. "ui\_control" lets me hide / show & jump to tabs very easily.

Example:  
{"tabs": {"show": "P360 Account Setup"}} followed by  
{"tabs": {"enable": "P360 Account Setup"}} then  
{"tab":"P360 Account Setup"}

Note - "P360 Account Setup" is the Tab name and there are ~ 30 different Tabs.

What I want to do (to eliminate tons of duplicate code and remove a source of error) is to make the Tab name a variable. E.g. {"tabs": {"show": msg.Tab}} where variable msg.Tab was previously set to the correct value.

Is this even possible? How might I go about this?

Cheers,

Paul

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [23 July 2020 08:44 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577/2 "2020-07-23T08:44:39Z")

</div>

basically what you have there... did you try it ?

---

<div class="post-metadata">

**Author:** ![paulkeates](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paulkeates](https://discourse.nodered.org/u/paulkeates)\
**Post date:** [23 July 2020 14:28 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577/3 "2020-07-23T14:28:24Z")

</div>

Hi,

I tried it using a Change Node. It puts a red border around the statement indicating it is not valid JSON:

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

If I include the double-quotes it is valid JSON but does not work.

Cheers,

Paul

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [23 July 2020 15:18 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577/4 "2020-07-23T15:18:35Z")

</div>

ah sorry - thought you had that in a function node

---

<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:** [23 July 2020 15:41 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577/5 "2020-07-23T15:41:17Z")

</div>

You can use the jsonata format (note, no `msg.`)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d18a0ccd205f1cbf79bdb26914464149431b1560.png)

Feed it into a debug node to check it looks right.

---

<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 September 2020 15:41 UTC](https://discourse.nodered.org/t/dashboard-ui-control-show-enable-tabs-using-variable-not-hard-coded/30577/6 "2020-09-21T15:41:20Z")

</div>

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