# Loading at the template Repeater all the time

**URL:** <https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518>\
**Category:** Ignition\
**Tags:** ignition80, scripting, python, vision, ignition81\
**Created:** [November 30, 2023, 9:49am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518 "2023-11-30T09:49:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adarsh\_Shelar](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adarsh\_Shelar](https://forum.inductiveautomation.com/u/Adarsh_Shelar)\
**Post date:** [November 30, 2023, 9:49am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/1 "2023-11-30T09:49:20Z")

</div>

Hi Connection,  
I have made the **template repeater**. and wrote script at property change as to show the tags value from the array Int data type. It's been executing according to the tag Value, but the Template repeater is loading all the time unable to see the stable screen. it is loading all the time.

Template Repeater Loading Image

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/f/ff609a62e79fc6bb3827af05c2da92d1c825dfd8.png)

Script to read the Tag Values.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/86923c9d3c8edf2b246a45ef11bb439022ac08d9.png)

Thank Connections,

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 30, 2023, 10:12am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/2 "2023-11-30T10:12:30Z")

</div>

Is your script changing the components own properties which will retrigger the script?

templateParams changes → propertyChange event → run script → write to params → propertyChange event → go to start and repeat.

Also, I think you should remove spaces in your array variables.  
`ActualInt [0].value` (wrong)  
`ActualInt[0].value` (correct).

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 30, 2023, 10:59am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/3 "2023-11-30T10:59:04Z")

</div>

I think you misunderstand what a property change script does.  
It triggers when a property on the component changes. ANY property, by the way, so you should ALWAYS filter on the property's name:

```python
if event.propertyName == "some_property":
    # do things

```

Anyway, that's probably not what you actually want.  
I'd suggest something, but I'm really not sure what it is exactly you're trying to do.  
Can you explain what's in your template, and when they should update ?

But if I had to guess the proper way of doing this:  
rework your template to take a tag path, then use this path in tag bindings IN THE TEMPLATE.  
Then just pass those paths to your repeater instances.

@Transistor:  
I agree that he should remove the spaces, but it's syntactically correct. Python doesn't care.

---

<div class="post-metadata">

**Author:** ![Adarsh\_Shelar](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adarsh\_Shelar](https://forum.inductiveautomation.com/u/Adarsh_Shelar)\
**Post date:** [November 30, 2023, 12:08pm UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/4 "2023-11-30T12:08:30Z")

</div>

Hi @Transistor & @pascal.fragnoud , Thanks for connecting me.,  
I have changed the script.still it's the same.  
**I have 5 tags value in the array format.so.will able to repeat the template according to size of the array, nearly 1 to 20 array bit it.so in my case I am Able to read all values, of tag but the Template is loading** ,  
And I have given the Print function over there its continuously repeating in the Loop at console when its Launched.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/8/986a2cb311c07dd5724db1c6bf172a7103493d4f.png)  
Script Changes,

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/7/670fb04d39961bf34d3fb875aa6af2b717ad1862.png)  
Console

**Tag Bindings According to template its possible but my tag value is in array format, so we are unable bind. though we are coming up with the Script format.**

Thanks, ✨

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 30, 2023, 12:11pm UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/5 "2023-11-30T12:11:52Z")

</div>

There's no way that script works.  
`event.source.Propety` is NOT valid.

Also, don't post screenshots of code, post the code itself, formatted with this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/1/f12a24f7970bdf02a284f5aa776918146033ad10.png)

You can bind arrays. Please tell us WHAT you want to do, not HOW you're trying to do it.

> [@Adarsh\_Shelar](#):
>
> **I have 5 tags value in the array format.so.will able to repeat the template according to size of the array, nearly 1 to 20 array bit it.so in my case I am Able to read all values, of tag but the Template is loading** ,

I have no idea what that means.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 30, 2023, 1:19pm UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/7 "2023-11-30T13:19:16Z")

</div>

Pascal's advice is correct. Use indirect binding with tag paths in your templates. Do **not** update the templates dataset in the repeater as tag values change. That reloads the templates, as you've noticed. Don't do that.

---

<div class="post-metadata">

**Author:** ![Adarsh\_Shelar](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adarsh\_Shelar](https://forum.inductiveautomation.com/u/Adarsh_Shelar)\
**Post date:** [December 1, 2023, 7:46am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/8 "2023-12-01T07:46:46Z")

</div>

@pascal.fragnoud I Have 4 tags with the array format, so I need to replace the all-array bit in the component of Template repeater so Binding the tag is not possible so will go with the Scripting.  
Just to replace all the 4-array tag. Bit in the Template repeter.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [December 1, 2023, 8:05am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/9 "2023-12-01T08:05:43Z")

</div>

Just because you don't know how to do it doesn't mean it's not possible...

Again, if you give us more details, we can help you find a better solution.  
But from what I understand, you have 4 array tags. Those are fixed so you don't even need to pass the paths to your templates, all you need is the instance number, which would correspond to the index of the value in the arrays. Then you use an expression like this:  
`{tagpath}[instance_num]`

Does vision have a built-in instance number property like the flex repeater ? If so, you don't even need to parameterize it.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 1, 2023, 10:58am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/10 "2023-12-01T10:58:33Z")

</div>

Typically, when I load a template repeater from an initialization script, I will do it from the propertyChange event handler like you did above, only I will specify the `componentRunning` event to ensure the script will only run once:

```auto
if event.propertyName == 'componentRunning':
     #ActualInt = system.tag.readBlocking...

```

The only thing that has to be remembered for testing purposes when using `componentRunning` is that the event won't occur in the designer unless preview mode is already running before the window with the component is opened.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [December 1, 2023, 11:13am UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/11 "2023-12-01T11:13:28Z")

</div>

How about one of the startup events ?  
`internalFrameActivated`, `visionWindowOpened`, this kind of thing ?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 1, 2023, 9:54pm UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/12 "2023-12-01T21:54:54Z")

</div>

> [@pascal.fragnoud](#):
>
> How about one of the startup events ?

The only one I would consider using for component initialization would be internalFrameOpened, but not for a component specific script. I feel that keeping a script like this with the component it affects is more intuitive and maintainable for future me and those who follow me.

> [@pascal.fragnoud](#):
>
> `internalFrameActivated`, `visionWindowOpened`

internalFrameActivated would reinitialize the component every time the window lost and subsequently regained focus, and I've heard of unexpected behaviors occuring with visionWindowOpened that I imagine are the result of the event firing before the internal components have been painted.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 1, 2023, 10:18pm UTC](https://forum.inductiveautomation.com/t/loading-at-the-template-repeater-all-the-time/82518/13 "2023-12-01T22:18:28Z")

</div>

These suffer from similar issues that the component running property does in the designer.

I believe that the internalFrameActivated will fire if you have multiple windows open and switch between them, but otherwise you have to close and reopen the window.
