I’m having some trouble figuring out a code for checking if a tag has a null value.
I have a string coming from the plc that changes between having 5 digits and 10 digits, (either 2 different part numbers or 1 part number) depending on what fixture is put in the machine. I have split the part numbers into 2 separate tags. When the string only has 5 digits, one tag is null.
I want to check if this tag is null, and write a value to a third tag ‘Bin 11-2’ depending on if it is or isn’t.
I’ve tried using IsNull and == None, but it’s not working… Am I missing something?
This is the code I have now (a tag event script) :
Any help would be appreciated!!
add a print statement before each step and you will know where you are getting stuck.
also your query tag what value does it show in the tag browser when you get the null value from the query? you need to make sure that you compare correctly the value you are getting.
you can put this on client scope script, tag event. and it will print on the client console
print 1
if previousValue != currentValue.value:
CrValue=currentValue.value
print 2
if CrValue is None:
print "ok"