PropertyChage running

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

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.

this is my code.

this is inside of my dropdown

I believe what you are looking for is this:

#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')

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.

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.

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

1 Like