Access dataset of a template

I have a table that is part of a template, and I would like to be able to access the table dataset from windows where the template is used. Is this possible?

I thought about creating a custom property on the template and binding that to the table dataset, but because I already have the table dataset tied to a SQL query, this won’t work.

If the table was placed directly on the window, then I would use this: event.source.parent.getComponent('PartsTable 1').data to get the data attribute, but becuase it’s inside of a template, this is not possible.

Other thoughts?

This is probably not the best solution, but you could write a propertyChange script on the template that copies any data that is in your table component to a template parameter each time data inside the template changes.

# Template
template = event.source.parent.getComponent('MyTableTemplate')

# Get the loaded template
loadedTemplate = template.loadedTemplate

# Get the table from the loaded template
myTable = loadedTemplate.getComponent("Power Table")
data = myTable.data
1 Like

Cool! Thanks. Nice and easy.

Does .loadedTemplate get the template instance that is being used on the current page?