# String Array Tag Read Fallback

**URL:** <https://forum.inductiveautomation.com/t/string-array-tag-read-fallback/96196>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [September 19, 2024, 5:13pm UTC](https://forum.inductiveautomation.com/t/string-array-tag-read-fallback/96196 "2024-09-19T17:13:47Z")\
**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 19, 2024, 5:13pm UTC](https://forum.inductiveautomation.com/t/string-array-tag-read-fallback/96196/1 "2024-09-19T17:13:47Z")

</div>

I've scripted a read from a string array tag using a tag path parameter to the function. I want to define the behavior when the tag path is empty or none.

So, how do I assign an empty string array to the same variable, in place of the string array read from the tag?

When I read from the tag I get this:

```python
array(java.lang.String, [u'e00002_Test', u'e00002_Test', u'e00002_Test', u'e00002_Test', u'e00002_Test', u'e00002_Test'])

```

and I want this for the empty/none result:

```python
array(java.lang.String, [])

```

How do I do that with python? - or do I need an empty string array tag to read? Or, should I just use it as a list/dataset for scripting and update my code accordingly?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 19, 2024, 6:10pm UTC](https://forum.inductiveautomation.com/t/string-array-tag-read-fallback/96196/2 "2024-09-19T18:10:16Z")

</div>

So you have a function that looks kinda like this:

```python
def read_tag(tag_path):
    string_array = system.tag.readBlocking([tag_path])[0].value
    data = do_stuff_with_the_array()
    return data

```

And you want to handle the case where `tag_path` is None ?

Feels like this should be enough:

```python
def read_tag(tag_path):
    if tag_path is None:
        return []
    string_array = system.tag.readBlocking([tag_path])[0].value
    data = do_stuff_with_the_array()
    return data

```

---

<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 19, 2024, 6:27pm UTC](https://forum.inductiveautomation.com/t/string-array-tag-read-fallback/96196/3 "2024-09-19T18:27:49Z")

</div>

Ya, the empty list seems to work
