Scripting indirect tag errror: 'unicode' and 'long' objects

Hi,
I wrote a script for an on click event to act as a toggle button.

I am getting this error

Error running action 'dom.onClick' on Page/Alarm_Setup_CCC@D/root/AlarmSetup1/Enable: Traceback (most recent call last):
File "function:runAction", line 2, in runAction TypeError: cannot concatenate 'unicode' and 'long' objects

I've checked over the tag path a couple times and I do not see the issue.
Any help would be great.

Thanks,
Gabe

You'll need to either convert self.custom.Number to a string, or use a string format option.

The next issue you'll run into is that system.tag.read*() functions return a list of QualifiedValues and you're not properly extracting the value from that list in your conditional statement.

Personally, I would write your script like this:

def runAction(self,event):
    path = '[{0}]Seqr_{0}/Alarms/Alarms_{1}_/Alarm/EnabledBits/TabBit_2'.format(self.view.custom.section,self.custom.Number)
    system.tag.writeBlocking([path],[not system.tag.readBlocking([path])[0].value])
4 Likes