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?
system.tag.readBlocking(['path/to/tag.propertyName'])
. You probably shouldn’t name them with spaces if you need to read them from scripting, though.
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
?
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.
"""
I think just tag.propertyName
.
Where would errors/messages from this script be visible?
You should see them in the tag diagnostics (an icon in the top right corner if you’re on 8.1.17+):

But with two properties I was able to read them directly off the tag
object in the event script:


1 Like
Thanks. I was also able to find it on the gateway here:
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()
)?
Switch your query type to Update?
2 Likes