startTime is the tag that is being read in the gateway script and box is the numeric entry field where the value 2 should be displayed.
Currently, the tag does have a value if 2. So, in theory, a value of 2 should be displayed.. but a 0 is being displayed. I can read the tag in correctly in the gateway script, but every time I use the tag in a conditional statement, it seems as if the value isn't being read..
I tried to just use the value attribute of the tag, but I get an error saying
You need to do some hunting then. Try logging the value and type of tag before the comparison.
Add something like:
# If you're running in a gateway context, this should show up on the webpage log viewer.
_logger = system.util.getLogger('script debug')
_logger.info(tag)
_logger.info(type(tag))
I am not receiving an error, the problem is that the conditional statement is returning a 0 when the value of the tag is, in fact, 2. So, the conditional statement should return a 2, rather than a 0.
I would then echo @zacht’s suggestion to log the data type of the value; perhaps it’s a string when you’re comparing it against an int? Python won’t do any automatic type coercion.