I’m trying to do the following in a project script:
def debugTest():
tester = system.tag.read("[Client]prevSt")
tester=tester + 1
system.tag.write("[Client]prevSt",tester)
but I get:
[code]Traceback (most recent call last):
File “”, line 1, in
File “module:project.stateMachine”, line 17, in debugTest
TypeError: unsupported operand type(s) for +: ‘com.inductiveautomation.ignition.common.sqltags.BasicTagValue’ and ‘int’
[/code]
The help file speaks of the toInt command when looking to do typecasting. A bit of rearranging gives me:
def debugTest():
tester = system.tag.read("[Client]prevSt")
intTester=toInt(tester) + 1
system.tag.write("[Client]prevSt",intTester)
Brilliant, yes?
No:
[code]Traceback (most recent call last):
File “”, line 1, in
File “module:project.stateMachine”, line 17, in debugTest
NameError: global name ‘toInt’ is not defined
[/code]
So how do I read a tag of type int, add one to it, and write it back from within a project script? This should be scripting 101, but I am at a loss.
Thanks!
Joe