# Tag Custom Property Access

**URL:** <https://forum.inductiveautomation.com/t/tag-custom-property-access/60409>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [June 6, 2022, 3:21pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409 "2022-06-06T15:21:22Z")\
**Posts on this page:** 9\
**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:** [June 6, 2022, 3:21pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/1 "2022-06-06T15:21:22Z")

</div>

I have a tag with a custom property defined. How do I access the tag’s custom property via scripting?

For instance, I have a tag called `Output` with the custom tag `enableLogging`. How would I access this property in a script, say a value change script?

`tag.enableLogging.value`? If so, custom property names are allowed to have spaces, how would this work with spaces?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2022, 3:30pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/2 "2022-06-06T15:30:33Z")

</div>

`system.tag.readBlocking(['path/to/tag.propertyName'])`. You probably shouldn’t name them with spaces if you need to read them from scripting, though.

---

<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:** [June 6, 2022, 3:31pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/3 "2022-06-06T15:31:47Z")

</div>

That’s what I figured. So, from the tag event script value changed scope, I should be able to use `tag.propertyName.value`, correct? or, just `tag.propertyName`?

```auto
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	"""
	Fired whenever the current value changes in value or quality.

	Arguments:
		tag: The source tag object. A read-only wrapper for obtaining tag
		     properties.
		tagPath: The full path to the tag (String)
		previousValue: The previous value. This is a "qualified value", so it
		               has value, quality, and timestamp properties.
		currentValue: The current value. This is a "qualified value", so it has
		              value, quality, and timestamp properties.
		initialChange: A boolean flag indicating whether this event is due to
		               the first execution or initial subscription.
		missedEvents: A flag indicating that some events have been skipped due
		              to event overflow.
	"""

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2022, 3:35pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/4 "2022-06-06T15:35:26Z")

</div>

I think just `tag.propertyName`.

---

<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:** [June 6, 2022, 3:43pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/5 "2022-06-06T15:43:18Z")

</div>

Where would errors/messages from this script be visible?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2022, 4:11pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/6 "2022-06-06T16:11:07Z")

</div>

You should see them in the tag diagnostics (an icon in the top right corner if you’re on 8.1.17+):  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f056512846beedccf9c54bcf42948b039d04ab9.png)

But with two properties I was able to read them directly off the `tag` object in the event script:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/acb0775922477bffd415eafc5b7c2ba1dc2564b9.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/4/d46cc4e50f7b411caee7d41c754e88f654c9d71e.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/4/645722d53b739a72abe081ae0e6aee35d54b280f.png)

---

<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:** [June 6, 2022, 4:35pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/7 "2022-06-06T16:35:02Z")

</div>

Thanks. I was also able to find it on the gateway here:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/4/54d3634439b10afd24c1cc20fbbb521df3eac90c.png)

Is there an easy way to get rid of the nuisance `The statement did not return a result set` SQL error (when using `system.db.runNamedQuery()`)?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2022, 4:38pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/8 "2022-06-06T16:38:22Z")

</div>

Switch your query type to Update?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 29, 2022, 7:59pm UTC](https://forum.inductiveautomation.com/t/tag-custom-property-access/60409/9 "2022-08-29T19:59:26Z")

</div>

2 posts were split to a new topic: [Question about looping through tags in scripting](https://forum.inductiveautomation.com/t/question-about-looping-through-tags-in-scripting/63579)
