I'm encountering an issue when trying to access a component value within a Template Repeater in Ignition. To debug this, I have created a simple test screen based on the example code provided in the user manual. My goal is to display the text of a Label component inside the Template Repeater as a message when the button is clicked. However, I keep encountering errors when attempting to do this. Here's a screenshot of my test screen and the code I am using. Please note that I have ensured the component names match those in the example code. Can anyone provide assistance or guidance on how to resolve this issue?
#This script will call getLoadedTemplates() on a Template Repeater, and
#then print the text property of a Label component in each instance
#Store a reference to the Template Repeater component in a variable
repeater = event.source.parent.getComponent('Template Repeater')
#Store the list of templates in another variable
templateList = repeater.getLoadedTemplates()
#Iterate through the list
for template in templateList:
#find a component named "Label" in the instance,
#and print the value of the text property
print template.getComponent('Label').text
error:
Traceback (most recent call last):
File "<event:actionPerformed>", line 8, in <module>
AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'getLoadedTemplates'
Ignition v8.1.21 (b2022092908)
Java: Azul Systems, Inc. 11.0.15
I also tried to change the getLoadedTemplates to getTemplateInstances , it does not work.