# IA Scripting: system.tag.getAttribute requires TagProvider

**URL:** <https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787>\
**Category:** Ignition\
**Created:** [July 24, 2014, 10:17pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787 "2014-07-24T22:17:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [July 24, 2014, 10:17pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/1 "2014-07-24T22:17:31Z")

</div>

My code seems to make sense and it looks like it would work fine:

```auto
tag = "MyTag"
if system.tag.exists(tag):
    doc = system.tag.getAttribute(tag, "Documentation")
    ...do stuff...
```

But I keep getting the error:

…‘MyTag’ does not exist…

Unless I change my code:

```auto
tag = "MyTag"
if system.tag.exists(tag):
    doc = system.tag.getAttribute("[MyTagProvider]" + tag, "Documentation")
    ...do stuff...
```

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [July 25, 2014, 2:26pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/2 "2014-07-25T14:26:48Z")

</div>

Sounds like exactly the behavior I’d expect when [MyTagProvider] != the internal provider named “default”

FWIW, Colby isn’t too happy with the implementation of system.tag.getAttribute(), so use it at your own peril. It’s still a part of 7.7 for backwards compatibility, but it’s been removed from the docs and intellihints to discourage its use. 🙂

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [July 25, 2014, 3:30pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/3 "2014-07-25T15:30:36Z")

</div>

> [@](#):
>
> Sounds like exactly the behavior I'd expect when [MyTagProvider] != the internal provider named "default"

Sorry for picking on you Kathy but this is not the behavior I'd expect.

Here's why:

The system.tag.read() function uses the project's default SQLTag provider when no provider is provided. For example if my project's default tag provider is "MyProvider" and I use "system.tag.read('MyTag')" then the actual tag path used is "[MyProvider]MyTag".

Now if I use system.tag.getAttribute("MyTag", "Documentation") then it tries to use the "default" provider even though my project's default SQLTag provider is different. This is inconsistent.

I understand it probably needs to be this way in Ignition 7.7 for backward compatibility with the IA Labs Scripting Module.

The documentation for system.tag.getAttribute() does say that it will use the "default" provider if no provider is provided. That's a good thing.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [July 25, 2014, 3:47pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/4 "2014-07-25T15:47:55Z")

</div>

Nick, perhaps I should have written “it’s the behavior I’d expect from the docs.” Sorry for not making that clear.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [July 25, 2014, 3:50pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/5 "2014-07-25T15:50:13Z")

</div>

I understand now Kathy. Makes sense.

---

<div class="post-metadata">

**Author:** ![jash](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jash](https://forum.inductiveautomation.com/u/jash)\
**Post date:** [November 27, 2014, 5:31am UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/6 "2014-11-27T05:31:21Z")

</div>

Kathy, you mentioned that the use of system.tag.getAttribute is discouraged. Is there another way to read the attributes of a tag? It seems that removing it from the docs is a bit strange if there is no alternative for doing something like

```auto
system.tag.getAttribute(tag.path, "ScanClass")
```

Is there another, safer way of doing this?

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [November 28, 2014, 4:31pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/7 "2014-11-28T16:31:54Z")

</div>

You should be able to read an attribute of a tag by using the [system.tag.read](https://support.inductiveautomation.com/usermanuals/ignition/system_tag_read.htm) command and using the “dot” notation to get it:

```auto
doc = system.tag.read("MyTag.Documentation").value
```

---

<div class="post-metadata">

**Author:** ![jash](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jash](https://forum.inductiveautomation.com/u/jash)\
**Post date:** [November 29, 2014, 3:47am UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/8 "2014-11-29T03:47:27Z")

</div>

Yes, but unfortunately system.tag.read only gets you 3 of the tag attributes - value, quality, and timestamp.  
I want access to all of the attributes which system.tag.getAttribute provides, but it isn’t documented and it’s use is ‘discouraged’.

There’s a list somewhere in the online documentation of all the tag attributes, but it’s almost impossible to find otherwise I’d post a link.

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [November 29, 2014, 6:50am UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/9 "2014-11-29T06:50:08Z")

</div>

The [attribute list](http://files.inductiveautomation.com/modulemarket/1/46/version/121/doc/system_tag_getAttribute.htm) is part of the IA Scripting user manual. (Find the “Tag Attribute” link under system.tag.getAttribute in the link I just posted.) You should be able to get any of the listed values simply by replacing the word “Documentation” in my previous code with any of those words.

---

<div class="post-metadata">

**Author:** ![jash](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@jash](https://forum.inductiveautomation.com/u/jash)\
**Post date:** [November 29, 2014, 9:54am UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/10 "2014-11-29T09:54:02Z")

</div>

Sorry, I didn’t read your code correctly. So to get attribute of tag one uses system.tag.read([tag path string]+’.’+[tag attribute string]).value

Thanks for helping me get there - and thanks for the link to the IA Scripting user manual.

---

<div class="post-metadata">

**Author:** ![papermaker](https://avatars.discourse-cdn.com/v4/letter/p/ea5d25/32.png) [@papermaker](https://forum.inductiveautomation.com/u/papermaker)\
**Post date:** [February 26, 2015, 7:34pm UTC](https://forum.inductiveautomation.com/t/ia-scripting-system-tag-getattribute-requires-tagprovider/8787/11 "2015-02-26T19:34:29Z")

</div>

There is probably an easier way to do this, but I was having a tough time reading parameters from a UDT in a Python-friendly format. I finally came up with: str(system.tag.read(‘tagname.ExtendedProperties’).value.local)  
and then sliced that back to the dictionary that ‘parameters’ takes for tag.write.  
If there is a syntax that gives me the dictionary directly, I would appreciate it, otherwise maybe this will save someone else the time it took to find the ugly approach above. ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")
