Accessing Template 'Internal Properties' from Template Instance

Is it possible to access Template custom ‘Internal Properties’ from the Template instance?

Possible? Yes, with scripting. Supported? No. Yes.

Use .getComponent(0) a couple times to drill down into the template instance to reach the root of the running template.

Edit: I stand corrected. (:

2 Likes

I’ve always used .getLoadedTemplate() to access the template’s root container.
After testing it seems this only allows me to get parameters and components within the template but not access the “Internal Properties”.

Seems like @pturmel’s way is documented here:
https://docs.inductiveautomation.com/display/DOC79/Advanced+Template+Features

Edit: further testing reveils I can only access internal properties via Template Repeater and Template Canvas.

tr = event.source.parent.getComponent('Template Repeater')
for template in tr.getLoadedTemplates():
	print template.getComponent('Label').text # component within the template
	print template.helloWorld # internal property
2 Likes