# Tab Strip

**URL:** <https://forum.inductiveautomation.com/t/tab-strip/3861>\
**Category:** Ignition\
**Created:** [January 14, 2012, 1:22am UTC](https://forum.inductiveautomation.com/t/tab-strip/3861 "2012-01-14T01:22:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [January 14, 2012, 1:22am UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/1 "2012-01-14T01:22:17Z")

</div>

Is it possible to include and expression/tag to disable individual tabs.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 14, 2012, 6:38pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/2 "2012-01-14T18:38:08Z")

</div>

No, you can’t disable individual tabs. However, you can set the navigation mode to manual where you can handle what happens when tabs are selected through a propertyChange script. Basically, the script will do nothing when a tab is disabled.

I will add a feature request in our system to add the ability to disable tabs.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 16, 2012, 6:49pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/3 "2012-01-16T18:49:30Z")

</div>

You can modify the Dataset to Show/Hide tabs. I did this to only show tabs according to roles.

I made a table in the database (in this case, maintabstrip, because, well, it’s my main navigation strip.) duplicating the Tab Data dataset fields. Then I added two more fields, Roles (varchar) and Use\_Roles (boolean). The Roles field holds a list of permissible roles. the Use\_Roles field, if zero, lets the tab be always displayed, or checks roles if it’s a one.

Lastly, I bound the Tab Data property of the Strip to the query:

`SELECT distinct(name),display_name,hover_color,
		selected_foreground_color,selected_background_color,selected_font,
		selected_gradient_start_color,selected_gradient_end_color,
		unselected_foreground_color,unselected_background_color,unselected_font,
		unselected_gradient_start_color,unselected_gradient_end_color,
		use_selected_gradient,use_unselected_gradient,mouseover_text	
FROM maintabstrip LEFT JOIN user_role_mapping
on FIND_IN_SET(user_role_mapping.rolename, maintabstrip.roles)
where username='{Root Container.Tab Strip.username}' or maintabstrip.use_roles=0
`

My caveat is that this is in MySQL which carries the nifty FIND\_IN\_SET function.

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [February 1, 2012, 12:43pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/4 "2012-02-01T12:43:06Z")

</div>

Joran,

The clone table you made of the dataset, are those all varchar?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 1, 2012, 3:47pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/5 "2012-02-01T15:47:06Z")

</div>

Yep! Well, mostly. 😆 I use TinyInt instead off Boolean for most items used as booleans, but that’s just more of a personal preference.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/fde4b0a8d7cd8dc41389866eb49c64774a0eacaf.png)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 1, 2012, 4:07pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/6 "2012-02-01T16:07:12Z")

</div>

Here’s the query I use to generate the tabs:

`SELECT distinct(name),display_name,hover_color,
		selected_foreground_color,selected_background_color,selected_font,
		selected_gradient_start_color,selected_gradient_end_color,
		unselected_foreground_color,unselected_background_color,unselected_font,
		unselected_gradient_start_color,unselected_gradient_end_color,
		use_selected_gradient,use_unselected_gradient,mouseover_text	
FROM maintabstrip left Join user_role_mapping
on find_in_set(user_role_mapping.rolename,maintabstrip.roles)
where username='{[System]Client/User/Username}' or maintabstrip.use_roles=0
order by Display_name`

And here’s a blank MySQL table to use.  
[tabstrip.sql](https://us1.discourse-cdn.com/inductiveautomation/original/1X/263e309b60b3e2c78b9da1751bd9172ada9d9eeb.sql) (2.77 KB)

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [February 2, 2012, 1:54pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/7 "2012-02-02T13:54:10Z")

</div>

Thanks ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")

---

<div class="post-metadata">

**Author:** ![cbabb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cbabb/32/49029_2.png) [@cbabb](https://forum.inductiveautomation.com/u/cbabb)\
**Post date:** [February 3, 2012, 2:31pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/8 "2012-02-03T14:31:47Z")

</div>

I use multiple rows of tabs to pick and choose dynamically built trend charts to look at processes/equipment and areas.

All my tabs (except the main tab which is hard coded through the tab control configuration) get their dataset based on the tab that’s selected above it. There is a script attached to the tab that will set a Client Tag that’s used to pick out which tabs are applicable. This cascades down the levels of tabs.

I added an additional field to the tab dataset that’s uses the Client Tag as a filter…

My main screen is as follows. Selecting a main tab will change the 3 rows of tab below it based on the selection:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/0a6e1e0e5b76a29acc09edc36909c01b689da616.PNG)  

When another tab is selected, it all changes:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/d2ca4dc63f436ead072ffa0abfbcbb093ecc83ad.PNG)  

The abbreviated scripting attached to the main tab is here:

[code] # when a new tab is selected, set the dynamic property for  
# the name of the selected menu

if event.propertyName == “selectedTab”:

```
	# Blending Tab Selection
if event.source.selectedTab == "Blending":
	event.source.parent.Selected_Menu = "Blending"
	event.source.parent.Selected_SubMenu1 = "AP Tanks"
	event.source.parent.Selected_SubMenu2 = "AP 10 Misc"

	# S1 Solid Line Tab Selection
elif event.source.selectedTab == "S1 - Solid Line":
	event.source.parent.Selected_Menu = "S1 - Solid Line"
	event.source.parent.Selected_SubMenu1 = "Outer Filler"
	event.source.parent.Selected_SubMenu2 = "Outer Filler Day Tank"

	# G1 Solid Line Tab Selection

```

……

```
	# write the selection into the SQLTag
system.tag.writeToTag("[Client]APDO/Selected_Menu",event.source.parent.Selected_Menu)

	# sets the selected tab
event.source.selectedTab = event.source.parent.Selected_Menu
event.source.parent.getComponent('SubMenu1').selectedTab = event.source.parent.Selected_SubMenu1
event.source.parent.getComponent('SubMenu2').selectedTab = event.source.parent.Selected_SubMenu2

	# write the tab name into the SQLTag
system.tag.writeToTag("[Client]APDO/Selected_Menu",event.source.parent.Selected_Menu)
system.tag.writeToTag("[Client]APDO/Selected_SubMenu1",event.source.parent.Selected_SubMenu1)
system.tag.writeToTag("[Client]APDO/Selected_SubMenu2",event.source.parent.Selected_SubMenu2)

```

[/code]

Once I have the tab names I need, I run the following query to get the Tab Data Property:

`SELECT *
FROM SETUP_APDO_Tab_Strip_Configuration
WHERE TAB_NAME = '{[Client]APDO/Selected_Menu}'`

My SQL Table for the tabs. TAB NAME is populated by me and contains the name of the tab selected in the row above where I want it to be displayed.:

![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/ede4944a77b60a8a942d874c1c377640e4f6edd8.PNG)

It’s a little clunky at times but allows me great flexibility and fairly quick modifications and additions.

My Charts kinda work the same way in that all my possible pens are in a SQL table with a couple of custom fields that use the tab name as their filter to display on the applicable chart as well as a couple of fields that allow me to put the pens on multiple charts. The SQL Query is:

`SELECT * 
FROM SETUP_APDO_Trend_Pen_Configuration
WHERE GROUP_NAME LIKE '{[Client]APDO/Selected_SubMenu2}%' 
OR GROUP_NAME = '-' 
OR CHART_1 LIKE '{[Client]APDO/Selected_SubMenu2}%'
OR CHART_2 LIKE '{[Client]APDO/Selected_SubMenu2}%'
OR CHART_3 LIKE '{[Client]APDO/Selected_SubMenu2}%'`

You’ll also notice that I added numbers in my pen names… 1) to avoid duplicate names, 2) so that I have a very quick reference when I need to change something in the database table.

This is by no means the easiest way to do things and I am positive that this could be cleaned up quite a bit… But hey, it was my first try at a lot of this stuff…lol…

The end result is that when my users ask for a change or a new tab or pen, it only takes a couple of minutes to get it in and working. Most of the time, without ever having to go into the designer…

I’m always open to new ideas and better ways to do things… any suggestions and/or opinions are welcome…

---

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [February 3, 2012, 11:38pm UTC](https://forum.inductiveautomation.com/t/tab-strip/3861/9 "2012-02-03T23:38:17Z")

</div>

Fantastic examples! Thank you all
