# system.tag.readBlocking() not working correctly

**URL:** <https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-correctly/77739>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 11, 2023, 6:42am UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-correctly/77739 "2023-08-11T06:42:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jarrod\_Woodall](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Jarrod\_Woodall](https://forum.inductiveautomation.com/u/Jarrod_Woodall)\
**Post date:** [August 11, 2023, 6:42am UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-correctly/77739/1 "2023-08-11T06:42:39Z")

</div>

I have this weird issue where Im running a onAction script on a button. I pull 4 binary tags into the code via system.tag.readBlocking("blah blah tag") but when i try to use it in a if statement the code seemingly doesn't work not errors just a flag int i have embedded in code gets to the point where its used.

My work around is assign the tag to a custom prop in the button and then reference this in the code "self.custom.tag" and then the rest of the code executes as expected. Has anyone had this before?

Code Example

```auto
tag = system.tag.readBlocking('[PLC]Test/Tags/Tag')
value = self.getSibling("Table").props.selection.data[0].name
faultInt = 0

if value == "John Smith" and not tag:
   faultInt = 10
else:
   print("Continue")

```

No matter the conditions i return 10. If i change the "tag" reference to be the custom one as described it all works as intended.

edit\* Formatted code for readability as suggested by nminchin.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 11, 2023, 7:02am UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-correctly/77739/2 "2023-08-11T07:02:21Z")

</div>

[system.tag.readBlocking](https://docs.inductiveautomation.com/display/DOC81/system.tag.readBlocking) returns a list of `QualifiedValue`, not a basic type. To read a tag value from the results, for example the first tagpath, you need to use something like:

```auto
tag[0].value

```

> [@Jarrod\_Woodall](#):
>
> ('[PLC]Test/Tags/Tag)

PS you've also missed an end quote

PPS. if you want to read multiple tags' values, the simplest way is to use:

```auto
(tag1,
 tag2,
 ...,
 tagN) = [qval.value for qval in system.tag.readBlocking([
 'tag1Path',
 'tag2Path',
 ...,
 'tagNPath'])
]

```

PPPS. Use ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/4/e446df290130ecf25e39face8cde98f3c54d748c.png) to format code, otherwise it's unreadable

Also, to diagnose things like this, you can always start by (reading the user manual) printing the `type()` of the object to the console. You can then see what it _is_ compared to what you expect it to be.  
e.g.

```auto
system.perspective.print(type(tag))

```

---

<div class="post-metadata">

**Author:** ![Jarrod\_Woodall](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Jarrod\_Woodall](https://forum.inductiveautomation.com/u/Jarrod_Woodall)\
**Post date:** [August 11, 2023, 7:53am UTC](https://forum.inductiveautomation.com/t/system-tag-readblocking-not-working-correctly/77739/3 "2023-08-11T07:53:39Z")

</div>

100% on the money, forget the syntax errors in my post i was just trying to get my issue to words 😅

Incorrect eval of the tag reference was def my issue (tag[0].value)

Thanks!
