Ok here is something for you to play with. Import this into a fresh project so it doesn’t interfere with anything you have now.
JC_TabStrip_From_Query_2020-10-13_1145.zip (6.6 KB)
I added two custom properties to the tab strip.
topic_list is bound to the named query, also named topic_list
tabFormat, I just copied from the default tabData, and deleted all but one row. We’ll use this in a bit to craete the new tabData.
In the propertyChange event:
if event.propertyName == 'topic_list':
# Get the tabstrip component. Since we will be referencing
# it a lot, it's handy to create an easy reference.
tabStrip = event.source
# Get the PyDataSet version of topic_list
topicDataSet = system.dataset.toPyDataSet(tabStrip.topic_list)
# Get the pyDataSet version of the tab format
formatDataSet = system.dataset.toPyDataSet(tabStrip.tabFormat)
# Create format list. It's just everything after the
# tab name and display name. This will get added to the id
# and topic from the topic list dataset
format = list(formatDataSet[0])[2:]
# Get the tabData headers. It's why I kept all the columns
# in for format dataset.
tabDataHeaders = list(formatDataSet.getColumnNames())
dataOut = []
# Iterate through the topics and add the format to it.
for row in topicDataSet:
dataOut.append(list(row) + format)
# Write the new tabData
tabStrip.tabData = system.dataset.toDataSet(tabDataHeaders, dataOut)