I’m trying to dynamically build a tab strip dataset so that different production lines show tabs relevant to the line. To give a brief rundown, each line has between 7-10 processes and I want each process to have its own tab based upon the line selected.
Right now I have two datasets: One is queried from a databse table and returns all the process names for a given line (line is a dynamic property on the root container). The second is my tab strip data, containing all the options for process tabs (created using the tab strip customizer so it has all 22 columns of tab strip configuration).
All I want to do is have the pertinent tab names show up in the tab strip, but am having trouble with the script. This was my first attempt, using a property change event on the tab strip:
“Processes” is a custom property querying the process names based upon line number
“Tabs” is a custom property which has all possibilities for tabs and includes tab strip data (22 columns)
for row in Names:
for rowNum in tabInfo:
if row["Name"] == rowNum["DISPLAY_NAME"]:
system.dataset.addRow(tabData,rowNum)
event.source.tabData = system.dataset.toDataSet(data)[/code]
This gave no error, but didn’t change the tabData either. So I tried another similar method after looking in the forums:
if event.source.propertyName == "Processes":
row = list(system.dataset.toPyDataSet(event.source.Tabs)[0])
Names = event.source.Processes
for num in range(Names.rowCount):
row[1] = rowNum[0]
event.source.tabData = system.dataset.addRow(event.source.tabData, num, row)
Tabs has ALL possibilities, and I’m trying to pick and choose the tabs I want to show up.
Here’s a general example:
Say, for instance, the Tabs property has tab A,B,C,D, and E configured. If I select line 1 I only want tab A,C, and E to show up. Line 2 may be tab A,B,C, and E.
That is where Processes comes in. I can query the database table that has the relationship between line and the tabs I want shown. I just need a way to say “ok, Processes gave me table A,B,and C to display for line #, now I’m going to push tab A,B,and C from Tabs into tab data”
Apologies for not being clear in the original post.
If you could, post up a copy of the Window. Maybe we can get a better idea on where things are going awry.
On the copy, if there’s any bound properties outside of the window, like a query or whatever, go ahead and unbind it. The data from the query will be left behind.
Ok, here’s a .proj of the window which is what I think you were talking about? Script changed ever so slightly so that the script will trigger on custom property “lineSelected” instead of processes (which was queried), so you can just put in a random number there to test. Really appreciate the help, thanks. ProcessNavigation.proj (12.1 KB)