Template labels won't maintain text in the repeater

I’ve been trying to get more cozy with the template capabilities of Ignition and a need arose that I thought would be perfect for the Template Repeater. I made a template of labels to be filled by a periodically changing dataset. Everything seems to be working except that all my labels disappear right after they are printed to the screen :scratch: . The template is just a collection of labels. Here is my script for the Template Repeater.

[code]s1c = event.source.parent.getComponent(“Schedule1Container”)
schedule = system.tag.read("[Client]schedule1").value
system.tag.write("[Client]schedule1count", schedule.rowCount)
tlist = s1c.getLoadedTemplates()

for index,template in enumerate(tlist):
template.getComponent(‘lblPartNumber’).text = schedule.data[0][index]
template.getComponent(‘lblQtyScheduled’).text = schedule.data[2][index]
template.getComponent(‘lblNote’).text = "Note: " + schedule.data[3][index]
[/code]

Thanks

So I finally gave in and called tech support last night. I’d like to thank Aaron for helping me figure out what I was doing wrong. :prayer: . I was using a dataset tag to supply the data for my templates and I wanted to insure I did not run into an index out of bounds error by writing the datasets rowcount to the template repeaters repeat count. I created a race condition that made the templates reset. when Aaron commented out the line my code worked. I already have code to update and setup my datasets at the project level so Aaron suggested I simply bind my datasets to the Template Parameters of the repeater and use the Dataset repeat behavior instead of the count behavior. Dope! I went overkill on the scripts this works perfect. Project level script to fill the datasets and bind an d forget :thumb_left:

1 Like