# Is there a way to dynamically change attributes for all tags

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-way-to-dynamically-change-attributes-for-all-tags/10031>\
**Category:** Ignition\
**Created:** [May 18, 2015, 3:22pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-dynamically-change-attributes-for-all-tags/10031 "2015-05-18T15:22:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [May 18, 2015, 3:22pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-dynamically-change-attributes-for-all-tags/10031/1 "2015-05-18T15:22:49Z")

</div>

I would like to set all tags for a device as disabled (Enabled = False) and then re-enable the all those same tags at a later time so that essentially a device can be taken offline (no new tag values being recorded because the customer has the device in a mode where they do not want the values recorded) and then put back online (tag value updates re-enabled).

There may be subfolders and more tags also, so I would want it to be recursive.

Example for one tag at a time:

`system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/MyDeviceFolder/MyTag_1", attributes={"Enabled":"False"})
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder /MyTag_2", attributes={"Enabled":"False"})
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder / MyDeviceSubFolder /MyTag_1", attributes={"Enabled":"False"})
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder / MyDeviceSubFolder /MyTag_2", attributes={"Enabled":"False"})`

I would like to do an equivalent that would disable all the tags recursively in one statement if possible:

```auto
system.tag.editTag(tagPath="MyOPCServer/DeviceSet/ MyDeviceFolder ", attributes={"Enabled":"False"})
```

I guess I could do something using system.tag.browseTags like:

`tags = system.tag.browseTags(parentPath=" MyOPCServer /DeviceSet/ MyDeviceFolder ")
     for tag in tags:
	     # Check for tags where tag.isOPC() is true and disable
	     # Check for tags where tag.isFolder() is true and do system.tag.browseTags on the subfolder
	     # etc…`

But is there a simpler solution?

---

<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:** [May 18, 2015, 4:28pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-dynamically-change-attributes-for-all-tags/10031/2 "2015-05-18T16:28:59Z")

</div>

Is there a reason you can’t use a “driven” scan class (or classes) with a slow rate of “0” ? With a boolean memory tag as the “driving” tag, your script would just set or reset it. Ignition would do the rest.

See [Scan Classes](https://support.inductiveautomation.com/usermanuals/ignition/index.html?scan_classes.htm) in the user manual.

---

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [May 18, 2015, 8:19pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-dynamically-change-attributes-for-all-tags/10031/3 "2015-05-18T20:19:43Z")

</div>

Thanks Phil. The “driven” scan class idea would work. But since there may be hundreds of devices and any single one of them may be taken “offline” at any point, I would potentially need hundreds of separate scan classes.

Also, our project allows for the customer to add new devices through a semi-automatic interface, which would require a new scan class to be automatically created with each new device. Doable, but more complicated than I had hoped.
