# PropertyChage running

**URL:** <https://forum.inductiveautomation.com/t/propertychage-running/42378>\
**Category:** Ignition\
**Created:** [January 18, 2021, 10:26pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378 "2021-01-18T22:26:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric.avila](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@eric.avila](https://forum.inductiveautomation.com/u/eric.avila)\
**Post date:** [January 18, 2021, 10:26pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/1 "2021-01-18T22:26:43Z")

</div>

Hi,

i know exist some topics about this, but i can`t find the solution to my problem.

I have a dropdown and after you select an option i set the data in some components, i use the propertyChange.

The problem is when the propoerty is running every 3 o 4 seconds, so i can`t put new values in my TextFields because the event change the values to the old values.

I read other topics and the solution were:

event.propertyChange == ‘selectedStringValue’ and event.source.componentRunning

but this send me an error: the objet has no attribute PropertyChange  
an this code  
event.newValue != event.oldValue

don`t work, the event continues running.

any idea?

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 18, 2021, 11:16pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/2 "2021-01-18T23:16:49Z")

</div>

You are confusing event. **propertyName** with something else. It is vital that you check the name of the property that is triggering the event because the **same** event script runs for _ **every** _ property the component has. If your script doesn’t check for the property you want to monitor, it’ll run for all kinds of unexpected property changes.

---

<div class="post-metadata">

**Author:** ![eric.avila](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@eric.avila](https://forum.inductiveautomation.com/u/eric.avila)\
**Post date:** [January 19, 2021, 1:59pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/3 "2021-01-19T13:59:02Z")

</div>

this is my code.

 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dc95e32c62bdf8499c70b040bfb4a444514eac67.png)

this is inside of my dropdown

---

<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:** [January 19, 2021, 2:16pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/4 "2021-01-19T14:16:20Z")

</div>

I believe what you are looking for is this:

```auto
#Filter the property Change so that this code only runs when the property you are interested in changes
#Filtre la propiedad Cambiar para que este codigo solo se ejecute cuando la propiedad en la que esta interesado cambie
if event.propertyName == 'selectedStringValue':
    value = event.source.selectedStringValue
    system.tag.writeBlocking(['[client]Sensores/seleccionT'], [value])
    Funcion.llenacombos(event,'TTarjetasDatos','Tarjetas')

```

---

<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 19, 2021, 2:34pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/5 "2021-01-19T14:34:44Z")

</div>

If your script uses “not equals” when checking the property name, then that code will run for many other properties changing. Always use either “equals” or an expression with the “in” operator.

---

<div class="post-metadata">

**Author:** ![eric.avila](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@eric.avila](https://forum.inductiveautomation.com/u/eric.avila)\
**Post date:** [January 19, 2021, 2:49pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/6 "2021-01-19T14:49:36Z")

</div>

thanks, it`s working now. when i saw the “event.propertyName” i was imagine this is the example and i need to replace with my event.

Thanks for the aclaration.

---

<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 19, 2021, 8:58pm UTC](https://forum.inductiveautomation.com/t/propertychage-running/42378/7 "2021-01-19T20:58:56Z")

</div>

If you _did_ also want to run it when the component is first loaded, you would add componentRunning into the props to look for:  
`if event.propertyName in ('selectedStringValue', 'componentRunning'):`

If it’s componentRunning, you probably also want to check if it’s 1,otherwise it will fire when it closes as well
