Got another question. I have two template repeaters set to the “count” repeat behavior. The templates inside are bound indirectly to tags. I would like to point each of the repeaters to a different folder, but can’t figure out how I would get the tag path from the template repeater to the bindings on the templates inside of it.
There may not be a solution, but does anyone have any ideas?
The canonical way to do this is to have a template parameter named ‘folder’, and a setting for that in your template repeater’s ‘Template Parameters’ dataset. If your scripts inside the template actually need to access the template repeater component, you could use something like this:[code]from javax.swing import SwingUtilities
from com.inductiveautomation.factorypmi.application.components import TemplateCanvas, TemplateRepeater
from com.inductiveautomation.factorypmi.application.components.template import TemplateHolder
for x in (TemplateCanvas, TemplateRepeater, TemplateHolder):
holder = SwingUtilities.getAncestorOfClass(x, comp)
holder = None
return None[/code]Pass ‘event.source’ to this holder() function. Or if you need this in a bound expression, pass ‘binding.target’ within the objectScript() expression function.
Ah, then use the ‘index parameter name’ in the repeater. The template must have a template parameter of that name, as an integer. Use that parameter inside the template to construct your indirect tag path.