[...]
print 'inside RC !'
if event.propertyName == "resultsProperty":
blabla
At the first execution, the script works normally.
( "inside RC!" is printed in the log and blabla is well executed)
Then the root container script is no longer executed !
("inside RC!" no longer appears).
if I change views, then the script works again, again only once.
Are you testing this in the designer or in an actual client? That can make a difference.
The fact that `print 'inside RC !' is only printing once, makes me feel like there is more context to these scripts then what your showing, as if that line was really the top line a property change script of the Root Container, you would definitely have it printed more than once.
The button is on the container:
HOME (with startup script)
__Root container (with script)
____container
______the button (so with script)
The problem occurs in preview mode as well as with client.
Yes, the line 'inside RC!' is printing more that once.
eg :
First run:
14:24:07.941 [AWT-EventQueue-0] INFO vision.App - Starting Up..
inside RC !resultsProperty
inside RC !qualityList
inside RC !dataQuality
inside RC !background$Quality
inside RC !componentRunning
[...] blabla (print out of the function longProcess)
inside RC !resultsProperty
-> execution ok
But, on the next try 'inside RC!' is never printed, as long as I stay on the same window.
In the root container, there is a try except section.
if ok then it does a system.nav.swapWindow
if except then it only does
event.source.getComponent('Container').getComponent('errorMsg').visible= 1
Okay, I threw together a quick test in my environment to try and replicate and was unable to replicate what you're seeing.
If you can't post the actual code then I would suggest you call into support, as it would appear that the issue is somewhere inside of one of the scripts. I'm not sure how much we're going to be able to help you without more information.
Window structure:
Property Change script on RootContainer:
if event.propertyName == 'resultsProperty':
print 'execute blabla'
import java.lang.Exception
from java.sql import SQLException
from MES.VARIABLES_GLOBALES import *
import ast
print 'inside RC !' + event.propertyName
if event.propertyName == "resultsProperty":
[..]
Here is an complet example of script for the button
import java.lang.Exception
from java.sql import SQLException
from MES.VARIABLES_GLOBALES import *
import ast
event.source.parent.getComponent('errorMsg').visible = 0 # on masque le messssage d'erreur de scan
event.source.componentEnabled = False # SB pendant la lecture, on neutralise le bouton
event.source.scanEnCours = True # on active 'scan en cours..." sur le bouton
print 'Debut script clic ' + str(system.date.now())
def longProcess(rootContainer = event.source.parent.parent):
import system
print 'avant readTagdata ' + str(system.date.now())
results={'ERREUR': 'Message non conforme : '}
print ' apres readTagdata ' + str(system.date.now())
def sendBack(results = results, rootContainer = rootContainer):
rootContainer.resultsProperty = results
print '3 apres rp=Res ' + str(system.date.now())
system.util.invokeLater(sendBack)
print '4 apres invokelater ' + str(system.date.now())
system.util.invokeAsynchronous(longProcess)
print 'FIN traitement clic ' + str(system.date.now())
log:
Debut script clic Mon Aug 21 15:36:21 CEST 2023
avant readTagdata Mon Aug 21 15:36:21 CEST 2023
apres readTagdata Mon Aug 21 15:36:21 CEST 2023
3 apres rp=Res Mon Aug 21 15:36:21 CEST 2023
inside RC !resultsProperty
resultsProperty non vide{'ERREUR': 'Message non conforme : '}
dicoRFid_API = tagResult {'ERREUR': 'Message non conforme : '}
Dan TRY RC Home
Dans Exept ! du RC
log for next try :
Debut script clic Mon Aug 21 15:37:00 CEST 2023
avant readTagdata Mon Aug 21 15:37:00 CEST 2023
apres readTagdata Mon Aug 21 15:37:00 CEST 2023
3 apres rp=Res Mon Aug 21 15:37:00 CEST 2023
but maybe you gave me the solution : the property don't change with the real command
(when pb occurs).
I have to force it to change after the first exec
I have to found how change event.propertyName after the first try.
I don't know if it's the good way but it's working :
I add a line event.source.parent.parent.resultsProperty=0 at the beginning of lingProcess:
def longProcess(rootContainer = event.source.parent.parent):
import system
# Do something here with the database that takes a long time.
event.source.parent.parent.resultsProperty=0
[...]
Thanks for you help, I spent hours for this problem !!
(I begin in Ignition script so it's not very easy for me.)