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

**URL:** <https://forum.inductiveautomation.com/t/scripting-indirect-tag-errror-unicode-and-long-objects/77866>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 15, 2023, 1:48pm UTC](https://forum.inductiveautomation.com/t/scripting-indirect-tag-errror-unicode-and-long-objects/77866 "2023-08-15T13:48:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Schwinghamme](https://avatars.discourse-cdn.com/v4/letter/g/8c91f0/32.png) [@Gabriel\_Schwinghamme](https://forum.inductiveautomation.com/u/Gabriel_Schwinghamme)\
**Post date:** [August 15, 2023, 1:48pm UTC](https://forum.inductiveautomation.com/t/scripting-indirect-tag-errror-unicode-and-long-objects/77866/1 "2023-08-15T13:48:24Z")

</div>

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

 ![Scrit](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/c/8c1a48b5e46a848dd6e5ed5de621a034bb8dfb8f.png)

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

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 15, 2023, 1:58pm UTC](https://forum.inductiveautomation.com/t/scripting-indirect-tag-errror-unicode-and-long-objects/77866/2 "2023-08-15T13:58:05Z")

</div>

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:

```auto
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])

```
