here is the code
C=currentValue.value
Stock=Carcass.LotStock(Lot=C)
system.perspective.print(Stock)
# I use the print to see the output
system.tag.write('[Malu OPC tags]Carcass/Scan/BarCode',C)
here is the code
C=currentValue.value
Stock=Carcass.LotStock(Lot=C)
system.perspective.print(Stock)
# I use the print to see the output
system.tag.write('[Malu OPC tags]Carcass/Scan/BarCode',C)
Print both current value and previous value.
Hi pturmel :How to modify the code meke it only trigger once, only base on the current value change?
I don’t know yet. You haven’t done as I suggested: print both current and previous value. That should tell you if this is a spurious event or a bug. Consider also printing the origin
value.
C=currentValue.value
P=previousValue
system.perspective.print('CURRENT'+str(C))
system.perspective.print('origin'+str(origin))
system.perspective.print('Pre'+str(P))
I have try the code
C=currentValue.value
P=previousValue
system.perspective.print('CURRENT'+str(C))
system.perspective.print('origin'+str(origin))
system.perspective.print('Pre'+str(P))
system.tag.write('[Malu OPC tags]Carcass/Scan/BarCode',C)
# write this data to tag
actually I need write the components value to that tag
The quality is changing. You will notice that in your second screen shot, the quality of the previous value changes from “Good” to “Good_Unspecified”. You will also notice that the origin changes.
My guess is the the tag quality change is triggering the binding to update.
if not currentValue.value == previousValue.value:
#your code here
system.tag.writeBlocking()
instead of the deprecated system.tag.write()
system.tag.writeBlocking(['[Malu OPC tags]Carcass/Scan/BarCode'],[C])
So, the property is bound to the tag that you are writing back to? If so, then of course you get another change event. The tag value, when written, is distributed to all bindings "listening" to it.
The origin property is there when you need such circular bindings, and want to suppress actions that don't come from the user (browser).
it works, thanks
I noted, thanks a lot