Write Tag with Custom Property

I have a custom property on a tag. Wondering if I would be able to change the value of this custom property using a script, and how I would go about doing so.

Something like system.tag.writeBlocking(['[default]pathToTag/tag/customINT])?

system.tag.writeBlocking(['[default]pathToTag/tag.customINT], [value])

Should work.

And reading, would .customINT be part of the qualified value or would it need to read separately in system.tag.readBlocking()?


custom, tag = [QV.value for QV in system.tag.readBlocking(['[default]pathToTag/Tag.customINT','[default]pathToTag/Tag'])]


tag_qv = system.tag.readBlocking(['[default]pathToTag/Tag'])]

tag_val = tag_qv.Value
tag_custom = tag_qv.customINT

Read separately.

Technically, you could read path/to/tag.jsonValues and get a rich document you can extract the value and custom property nodes from in one call, but I wouldn't both if you just want two values.

1 Like

If you really want to get fancy, maybe something like this:

def readWithProperties(path, *properties):
	props = ["value"]
	paths = ["path.{}".format(property) for property in props]
	return [QV.value for QV in system.tag.readBlocking(paths)]

tag, custom = readWithProperties("[default]pathToTag/Tag", "customINT")