I have a Vision Barcode Component which displays data from a tag. Between parts, the tag is empty so the Barcode Component shows a red error which is ugly.
I'm using property change script to try to hide the ugly control:
if event.propertyName == "code": # Ensure we only trigger on text changes
barcode_value = event.source.code # Read the current barcode value
if barcode_value is None or barcode_value == "" or barcode_value == "0":
event.source.visible = False
else:
event.source.visible = True
But something seems to be generating an exception:
12:26:37.682 [AWT-EventQueue-0] ERROR Vision.Barcode - Caught unexpected exception while recalculating barcode size for string 'null'
java.lang.NullPointerException: null
It really seems like there should be a "hide if no data" checkbox on the Barcode Component. What is the proper way to use the Barcode Component 'between parts' when there is no barcode?
(edit: fixed formatting)