I’m working with a template which has two UDT custom properties bound (see attached template), my problem is that I get an error related to the template´s property change script, which says:
I’m gobsmacked, the only way I’ve been able to solve the problem, has consisted of creating new internal properties and assigning the ‘problematic’ existing attributes to these internal variables.
These are the kind of bugs that make me lose my confidence in Ignition.
First of all you will need to separate out the events using:
if event.propertyName == "Compresor":
blah blah
if event.propertyName == "Variador":
blah blah
I don’t think you can drill down into the UDTs this way.
You can try doing the following:
Create Color as an internal property of the template.
Bind it to an expression:
I don’t agree with you, I’ve many other templates for pumps, tanks, towers, etc where I’ve directly used the UDT properties in scripting and work perfectly.
I tested further and you are right and I am wrong. I now agree with you that UDT instance sub tags can be referenced the way you are doing it in scripting.
Are you sure that the Variador template property is actually bound to an instance of the MOTOR_VARIADOR UDT?
I get the same error you get when the Variador property is not bound.
I see. Is it possible for you to export the window that is using the template that is having the error? Or if you don’t want to export that window then can you duplicate the same error in another window? Then upload the export to this thread.
If there is a bug and if we can reproduce it then IA will get it fixed.
I was able to consistently reproduce the error. I would get the “AttributeError: ‘com.inductiveautomation.factorypmi.application.bin’ object has no attribute ‘ESTADO’” when opening the Aqua_clima window. Is this when you are getting the error?
This seems to be a timing problem. I was able to fix the problem by using this code in the propertyChange event script:
def func(event=event):
if event.source.Compresor.FALLOS>0:
event.source.Color=1
elif event.source.Variador.ESTADO:
if event.source.Variador.MAN or not(event.source.Compresor.REMOTO):
event.source.Color=3
else:
event.source.Color=4
elif event.source.Variador.HORAS_SERV>event.source.Variador.HORAS_MANTENIMIENTO:
event.source.Color=2
else:
event.source.Color=0
system.util.invokeLater(func)