Template repeater get selected instance

How can I get an identifying value of a selected template instance from the template repeater so I can reference that template instance in other components on my window? I would like to be able to click on a template within the template repeater and read a template parameter via scripting.

Here is something to get you started. This script is on a button in the same window as a Template Repeater. This is essentially going into the the Template Repeater from some container.

templateRepeater = event.source.parent.getComponent('Template Repeater')

templates = templateRepeater.getLoadedTemplates()

for template in templates:
	print template

The method below is going from a component that is in a template that is in a Template Repeater out to whichever container is housing the Template Repeater. I placed this script is on a button that is in a template that is in a Template Repeater.

templateRepeater = event.source.parent.parent.parent.parent.parent

templates = templateRepeater.getLoadedTemplates()

for template in templates:
	print template

There’s probably an easier way to do this but this is the method that I’ve used.

1 Like

Thanks. Got something working with your method.

event.source.parent.parent.parent.parent.parent.parent.getComponent(‘Label’).text=event.source.parent.Path