# Read a Folder Full of Tags via Script

**URL:** <https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [July 16, 2025, 8:24am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534 "2025-07-16T08:24:15Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 16, 2025, 8:24am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/1 "2025-07-16T08:24:15Z")

</div>

Hi, teh question is quite easy, how could I read a folder full of tags?

I have a folder `[default]TestAlarms` inside of it I have something liket his:  
`[default]TestAlarms/tag_1`  
`[default]TestAlarms/alarm`  
`[default]TestAlarms/test_8`  
`[...]`  
Can I do something like this `system.tag.readBlocking(["[default]TestAlarms/*"])`? I'm having no luck.

Thx in advance!

---

<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:** [July 16, 2025, 8:36am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/2 "2025-07-16T08:36:56Z")

</div>

No, but you can use system.tag.browse to get your tag paths to supply to readBlocking

Eg

```python
tagPaths = [str(tag["fullPath"]) for tag in system.tag.browse("TestAlarms", filter={"tagType": "AtomicTag"})]

system.tag.readBlocking(tagPaths)

```

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 16, 2025, 9:20am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/3 "2025-07-16T09:20:11Z")

</div>

Just to leave it here. My original objective was to see if any of those tags is set to True.  
I think I'm simply gonna use a system.tag.query()

> **Code**
>
> ```python
> provider = 'default'
> limit = 100
> 
> query = {
> "options": {
> "includeUdtMembers": True,
> "includeUdtDefinitions": False
> },
> "condition": {
> "path": "TestAlarms/*",
> "attributes": {
> "values": [],
> "requireAll": True
> },
> "properties": {
> "op": "Or",
> "conditions": [
> {
> "op": "And",
> "conditions": [
> {
> "prop": "value",
> "comp": "Equal",
> "value": "True"
> }
> ]
> }
> ]
> }
> },
> "returnProperties": [
> "tagType",
> "quality"
> ]
> }
> 
> results = system.tag.query(provider, query, limit)
> 
> ```

---

<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:** [July 16, 2025, 12:44pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/4 "2025-07-16T12:44:28Z")

</div>

> [@danielps1818](#):
>
> My original objective was to see if any of those tags is set to True.

You can certainly use `system.tag.query()` if you want, but it isn't too much of a strech to take Nick's code and return only the paths with true values.

```python
tagPaths = [tag['fullPath'].toStringFull() for tag in system.tag.browse('TestAlarms',filter={'tagType':'AtomicTag','dataType':'Boolean'}|)]
print [path for path,qv in zip(tagPaths, system.tag.readBlocking(tagPaths)) if qv.value]

```

If you need it to drill down into nested folders then you can include the `recursive` flag in the filter. Just be careful where you run the script if you decide to do that.

---

<div class="post-metadata">

**Author:** ![vtran](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vtran](https://forum.inductiveautomation.com/u/vtran)\
**Post date:** [July 16, 2025, 2:41pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/5 "2025-07-16T14:41:14Z")

</div>

If you only care about the value of the tags, `system.tag.browse` would already give you their values, so no need to do another `system.tag.readBlocking`. something like this would give you all the `true` alarms

```python
results = system.tag.browse("[default]TestAlarms").results
activeAlarms = [tag.get('name') for tag in results if tag.get('value').value == True]

```

---

<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:** [July 16, 2025, 4:45pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/6 "2025-07-16T16:45:38Z")

</div>

Careful, this will **not** work without at a minimum a filter for AtomicTags. Any nested folders or UDT's will not have the 'value' key, and so will throw an AttributeError.

Also, returning the 'name' is not a great solution here either, as it is entirely possible that some tags have the same names, you really need the full path or at least as much of the path as possible to defierintiate tags, thus the use of 'fullPath'.

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [July 16, 2025, 7:11pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/7 "2025-07-16T19:11:06Z")

</div>

well, tbf,

```python
results = system.tag.browse("[default]TestAlarms").results
activeAlarms = [tag.get('name') for tag in results if tag.get('value', None). __getitem__ ('value', False) == True]

```

will work

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 16, 2025, 7:17pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/8 "2025-07-16T19:17:32Z")

</div>

> [@Leor\_Fishman](#):
>
> `if tag.get('value', None)`

~~This will be false if an atomic tag happens to have a zero value, or an empty string value, skipping those valid tags.~~ _Meh._

(Seems to have a typo, too. So no, won't work.)

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [July 16, 2025, 7:26pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/9 "2025-07-16T19:26:10Z")

</div>

i thought the intent was to get atomic tags with a value of True? good call on the typo, though

---

<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:** [July 16, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/10 "2025-07-16T19:27:52Z")

</div>

> [@Leor\_Fishman](#):
>
> well, tbf,

I have some personal peev's about utilizing `get*()` on a dictionary when you would "expect" it to have the key. Personally I find the following to be more readable, and it doesn't make my eye twitch.

```python
results = system.tag.browse('[default]TestAlarms', filter={'tagType':'AtomicTag'}).results
activeAlarms = [tag['fullPath'] for tag in results if tag['value'].value]

```

Exact same functionality, no dunder methods, will work 100% of the time. A small price to pay for adding a filter IMO.

Would even be simple to parameterize it into a function, though making it robust enough to handle multiple tag types would take a bit of work.

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [July 16, 2025, 7:29pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/11 "2025-07-16T19:29:53Z")

</div>

yeah, you're not wrong. I was tempted to try to do it with lambdas but then even _my_ eyes started twitching

---

<div class="post-metadata">

**Author:** ![vtran](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vtran](https://forum.inductiveautomation.com/u/vtran)\
**Post date:** [July 16, 2025, 8:53pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/12 "2025-07-16T20:53:32Z")

</div>

Yep, didn't test with nested folders 😆

I thought about `fullPath`, but since there's no `"recursive": True` in the filter, I figured `name` would be sufficient.

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 17, 2025, 7:06am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/13 "2025-07-17T07:06:12Z")

</div>

Is there any real difference (not taking count of the returned object) of using `system.tag.query()` or using `system.tag.browse()`? Wanna use the most efficient one.

I really only care if there is any true value, I don't care which tags are set to true.

---

<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:** [July 17, 2025, 8:39am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/14 "2025-07-17T08:39:37Z")

</div>

Browse is faster, not significantly. More efficient would be to cache the returned tagpaths and read the cached list

---

<div class="post-metadata">

**Author:** ![gregory.sachs](https://avatars.discourse-cdn.com/v4/letter/g/e47774/32.png) [@gregory.sachs](https://forum.inductiveautomation.com/u/gregory.sachs)\
**Post date:** [July 17, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/15 "2025-07-17T19:27:11Z")

</div>

If this is for a visualization, and inferring that the goal is to tell that an alarm is true, can you use the isAlarmActive expression?  
[https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/alarming/isAlarmActive](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/alarming/isAlarmActive)

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 18, 2025, 10:36am UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/16 "2025-07-18T10:36:27Z")

</div>

Those aren't real Ignition Alarms. Those alarms are from a machine, they send us like 100 differents tags that when true means that an alarm in the machine is on. That's why I need to check if any is on.

---

<div class="post-metadata">

**Author:** ![gregory.sachs](https://avatars.discourse-cdn.com/v4/letter/g/e47774/32.png) [@gregory.sachs](https://forum.inductiveautomation.com/u/gregory.sachs)\
**Post date:** [July 18, 2025, 12:33pm UTC](https://forum.inductiveautomation.com/t/read-a-folder-full-of-tags-via-script/108534/17 "2025-07-18T12:33:26Z")

</div>

I guess my answer to that would be to make them ignition alarms, because once you know that there is an alarm, the next step will be wanting to know what the alarm is and be able to analyze which alarm is causing the problem.
