# Access array tag elements with readBlocking

**URL:** <https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604>\
**Category:** Ignition\
**Created:** [December 30, 2021, 4:54pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604 "2021-12-30T16:54:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [December 30, 2021, 4:54pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/1 "2021-12-30T16:54:56Z")

</div>

I realize this is an old thread, reviving due to system.tag.read function being depreciated. If utilizing the system.tag.readBlocking function (where a list of tag paths returns a list of qualified values), the return when reading an array from the database is somewhat different.  
The below .read() returns an array of values matching the tag array:

```auto
tagArr = system.tag.read(tagPath).value
for i in range(len(tagArr)):
    print "[%i]=%s" % (i, tagArr[i])

```

Whereas the below (failed) attempt using .readBlocking() appears to return the definition of the array tag, which contains a single element resembling a concatenation of all tag element values:

```auto
tagArr = system.tag.readBlocking(tagPath)
for i in range(len(tagArr)):
    print "\n[%i]=%s" % (i, tagArr[i].value)

```

Can the code above be modified to match functionality of the .read() function (return a single array of qualified values)? Or, must each element in the array be read individually and appended to a local array variable, perhaps within a for loop?

---

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [December 30, 2021, 6:05pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/2 "2021-12-30T18:05:29Z")

</div>

> [@Chris\_Bingham](#):
>
> Can the code above be modified to match functionality of the .read() function (return a single array of qualified values)?

Clearly I'm struggling through some fundamentals here. I recognized that the readBlocking() is returning the entire tag to the only element [0]. When I moved the **values** of [0] to another holding tag, I was able to proceed using readBlocking().

```auto
tagArr = system.tag.readBlocking(tagPath)
tagArr0 = tagArr[0].value
for i in range(len(tagArr0)):
    print "[%i]=%s" % (i, tagArr0[i])

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 3, 2022, 3:27pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/3 "2022-01-03T15:27:14Z")

</div>

`system.tag.readBlocking` returns a list of values, always, regardless of how many paths you give it at the start. That’s by design. Unfortunately, a complexity of array tags is that reading a single one _also gives you a list of values_, so when you do a read of an array tag you get a “2D” structure like this:

```auto
[
    [value1, value2, value3],
]

```

Note that if you were to read another, non-array tag the structure might be more clear:

```auto
[
    [value1, value2, value3],
    anotherTagValue,
]

```

One thing you could is flatten the list, if you know you’re only reading one array tag. Another thing you could do is extract the first element, as you’re doing in your second post.

A small point of syntax for you; you don’t need `range(len(datastructure))` very often in Python/Ignition; usually you can directly iterate collections, i.e.:

```python
tagValues = system.tag.readBlocking(tagPath)
arrayTag = tagValues[0].value
for value in arrayTag:
	print value, type(value)

```

---

<div class="post-metadata">

**Author:** ![bdesireddy](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@bdesireddy](https://forum.inductiveautomation.com/u/bdesireddy)\
**Post date:** [July 22, 2025, 6:34pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/4 "2025-07-22T18:34:52Z")

</div>

Hi ,  
Quick question regarding accessing the array values:

If I have an array which has multiple components like part type and count and I want to select a particular part type and count associated with it, how can I script in the value changed?

---

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [July 22, 2025, 7:14pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/5 "2025-07-22T19:14:43Z")

</div>

Are you able to share a screenshot or code snippet of your tag data?

---

<div class="post-metadata">

**Author:** ![bdesireddy](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@bdesireddy](https://forum.inductiveautomation.com/u/bdesireddy)\
**Post date:** [July 22, 2025, 7:41pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/6 "2025-07-22T19:41:23Z")

</div>

Unfortunately not able to share the code details  
it is a dataset[7R x 7C] type, I want to read value from dataset[3,4].  
If I use the readblocking, will it give the data like this or it will only give the data in the first column?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [July 22, 2025, 7:53pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/7 "2025-07-22T19:53:49Z")

</div>

If your tag is a dataset, `readBlocking` will return the whole dataset, which you will then need to call `.getValueAt(3,4)` on to retrieve the value you are looking for.

> **[Datasets | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/scripting/python-scripting/variables-datatypes-and-objects/datasets#accessing-data-in-a-dataset)**
>
> Datasets and PyDatasets

---

<div class="post-metadata">

**Author:** ![bdesireddy](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@bdesireddy](https://forum.inductiveautomation.com/u/bdesireddy)\
**Post date:** [July 22, 2025, 8:56pm UTC](https://forum.inductiveautomation.com/t/access-array-tag-elements-with-readblocking/54604/8 "2025-07-22T20:56:54Z")

</div>

Thank you
