Tab Strip

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

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.

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.

Joran,

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

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


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 (2.77 KB)

Thanks :thumb_left:

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:


When another tab is selected, it all changes:


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.:


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…

1 Like

Fantastic examples! Thank you all