Well, I'm going to have at least 19 instances, 16 of one template, 3 of another.
I couldn't figure out how to go that deep in the example above, so I built another.
This time: Repeater with a dataset, and each instance is a Template of 3 templates.
Each grouping, including the large button is a template, the internal templates/
UDTs are the three "line items".
I'm having a hard time wrapping my head around getting to the nested templates/repeaters (in the first post).
repeater = event.source.parent.getComponent('Template Repeater 2')
for template in repeater.loadedTemplates:
template2 = template.getComponent('Zone_3Pos')
template2.templateParams['toggle_main'] = 1
The above code presents the error: Nonetype has no attribute: templateParams
, which refers to template2
variable.
repeater = event.source.parent.getComponent('Template Repeater 2')
for template in repeater.loadedTemplates:
arguments = []
for customProp in template.dynamicProps:
arguments.append(template.getPropertyValue(customProp))
print(arguments)
EDIT:
This code prints out 9 values, which appear to be the custom property values of each individual template/UDT and their parent templates. But, I manually counted 10 custom props, instead of 9.
That was wrong... the customProps
are from the group template, meaning the second nested template.
Print output:
[0, 0, 0, 0
, UDTProperty[type=_types_/Power_Supply_,path=<null>]
, UDTProperty[type=_types_/Power_Supply_,path=<null>]
, UDTProperty[type=_types_/Power_Supply_,path=<null>]
, 7, u'07']
Can I assign a value to the parameters from here? If so, how do I target a specific one? Like template.templateParams['toggle_main'] = 0
?