# Scripting with Array Tags

**URL:** <https://forum.inductiveautomation.com/t/scripting-with-array-tags/95972>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [September 13, 2024, 7:28pm UTC](https://forum.inductiveautomation.com/t/scripting-with-array-tags/95972 "2024-09-13T19:28:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 13, 2024, 7:28pm UTC](https://forum.inductiveautomation.com/t/scripting-with-array-tags/95972/1 "2024-09-13T19:28:51Z")

</div>

How does one script with array tags?

For instance, I want to create a button that adds an element to an array tag that already exists.

So, I need to read the array, add an element to the end, and then write it back.

What is the exact syntax to do that?

---

<div class="post-metadata">

**Author:** ![chandler](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@chandler](https://forum.inductiveautomation.com/u/chandler)\
**Post date:** [September 13, 2024, 8:57pm UTC](https://forum.inductiveautomation.com/t/scripting-with-array-tags/95972/2 "2024-09-13T20:57:22Z")

</div>

When you read an array tag in a script, you get a python array object. If the tag already has an array value, then you can just read the value from the tag using `system.tag.readBlocking` then use any method of the array class to manipulate it before you write it back to the tag, or do anything else you want to do with it.

documentation on python arrays:

> **[array — Efficient arrays of numeric values](https://docs.python.org/3/library/array.html)**
>
> This module defines an object type which can compactly represent an array of basic values: characters, integers, floating-point numbers. Arrays are sequence types and behave very much like lists, e...

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [September 13, 2024, 9:43pm UTC](https://forum.inductiveautomation.com/t/scripting-with-array-tags/95972/3 "2024-09-13T21:43:02Z")

</div>

Here's a quick example of the button you described:

```python
def runAction(self, event):
	tagPaths = ['[default]charArr']
	arrayTag = system.tag.readBlocking(tagPaths)[0].value
		
	arrayTag.append("123")
	system.tag.writeBlocking(tagPaths, [arrayTag])
	

```
