# propertyChange in a template

**URL:** <https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708>\
**Category:** Ignition\
**Created:** [January 28, 2021, 4:48pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708 "2021-01-28T16:48:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [January 28, 2021, 4:48pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/1 "2021-01-28T16:48:45Z")

</div>

I’m using a propertyChange in a template, the problem that I’m that this script executes when opening the window where the template is located.

‘value’ is the value of a ‘numeric label component’

```auto
if event.propertyName=='value':
	event.source.parent.getComponent('Timer').running=1

```

can someone help me to fix this. thanks

---

<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:** [January 28, 2021, 6:10pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/2 "2021-01-28T18:10:39Z")

</div>

What is the problem? Every bound property changes on startup (window or template) when the initial value arrives.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 28, 2021, 6:25pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/3 "2021-01-28T18:25:45Z")

</div>

```auto
if event.propertyName == 'value' and not event.propertyName == 'componentRunning':
	event.source.parent.getComponent('Timer').running = 1
```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 28, 2021, 9:05pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/4 "2021-01-28T21:05:53Z")

</div>

> [@dkhayes117](#):
>
> if event.propertyName == 'value' and not event.propertyName == 'componentRunning': event.source.parent.getComponent('Timer

Not going to work, the OP is already filtering out componentRunning events; those two conditions are by definition mutually exclusive as all events happen independent of one another

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 28, 2021, 9:12pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/5 "2021-01-28T21:12:25Z")

</div>

Yeah, I see what you are saying about the mutual exclusion.

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [January 29, 2021, 8:44am UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/6 "2021-01-29T08:44:54Z")

</div>

I forgot to say that I have not associated any udt to the template. I associate the value with a parameter, in which from a window I paste the path of the tag.

I have made a test of associating a udt with the template, and associating the value with the property of the udt, now the script is not executed every time I open the window where the template is, but every time I access the application from the client ( much better than in the previous case).

is there a way to ignore the initial value that the template has?  
Thank you very much everyone for the help.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 29, 2021, 10:45am UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/7 "2021-01-29T10:45:54Z")

</div>

This may help

> [@Ignore propertyChange script on load](http://forum.inductiveautomation.com/t/ignore-propertychange-script-on-load/18190/2):
>
> I usually solve these sorts of problems by modifying the bindings supplying the initial values to the entry fields. Specifically, I add custom properties for the “raw” or incoming value, and uni-directionally bind the component’s value field (dateValue in this case) to that custom property. Then in your existing propertyChange scripts, also check if the new value matches the custom property. If so, it wasn’t operator entry, and that event can be ignored.

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [January 29, 2021, 2:17pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/8 "2021-01-29T14:17:12Z")

</div>

I followed the instructions but without result. I’m going to keep trying. any other solution is appreciated. thanks you

---

<div class="post-metadata">

**Author:** ![mirandajoseph549](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@mirandajoseph549](https://forum.inductiveautomation.com/u/mirandajoseph549)\
**Post date:** [February 1, 2021, 5:10pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/9 "2021-02-01T17:10:12Z")

</div>

Have You,already, fixed it?

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [February 1, 2021, 8:01pm UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/10 "2021-02-01T20:01:27Z")

</div>

not yet

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [February 2, 2021, 11:13am UTC](https://forum.inductiveautomation.com/t/propertychange-in-a-template/42708/11 "2021-02-02T11:13:20Z")

</div>

@pturmel you can upload a project where it shows an example, thanks you
