Updating the value in custom property (document type) in a tag

Hi Ignition Community,

I have a Tag with custom property which is of Document data type as shown.

Now I want to update the value of this document using script below

Tagpath = '[provider]ParentFolder/SubFolder/Tagname.TagStates'

Doc_value = system.tag.readBlocking([Tagpath])[0].value
print Doc_value
print type(Doc_value)

Doc_value = system.util.jsonDecode(str(Doc_value))
Doc_value['0'] = 'Sample'
Doc_value_encode = system.util.jsonEncode(Doc_value)

system.tag.writeBlocking([Tagpath], Doc_value_encode)

Doc_value_read = system.tag.readBlocking([Tagpath])[0].value
print Doc_value_read
print type(Doc_value_read)

As we can see in the script console screenshot above, the custom property datatype which was initially PyDocument is changed to unicode after updating the value eventhough jsonEncode is used before writing the value to tag.Also when the tag editor is opened , it is shown as text below in the custom property


Please advice on how to update the document property without disturbing the initial datatype (PyDocument)

The Ignition version used is 8.1.21.

Thanks in advance for the support.

Have you tried not passing your data through json encode at all?
The whole point of jsonEncode is that it takes a list or dictionary and returns a plain string - so when it makes it through the tag system to the custom property, of course it's a string.
But if you write a dictionary directly, it should be implicitly converted to an appropriate type, which would be document.

Hi @PGriffith ,

Thank you for the response.

I tried by passing the data without json encode (as shown below) , but the instead of changing to document type, it's being displayed as 'Unknown type' within the tag. If i try to read it again , it is showing as dictionary. I am not sure why the Pydocument datatype is lost once we try to update it.

I just added to this topic Data type of tag custom property about how when you try to change a custom tag properties data type through script it fails or if it does work you get a dictionary/array as the value in ignition and the dataType never changes.

Has any progress been made on this?

output when i try to do this dynamiclly through script:

script I used to start testing:

#UDT Definitnon:
topFolder = "[Coc]_types_/PathTo/PathTo_TAG

tagObject = [{
			'PI_Tag': {'tagType':'String','value':'test'} 

system.tag.configure(topFolder, tagObject, 'm')


The document datatype issue which I raised here was fixed with version 8.1.32

This version accepts PyDictionary and there's no issue in scripting part. I suggest you to try an updated version for the datatype issue as well


Good Morning! Thank you @nandakumar.g2 for this update. When I had posted my comment it only had the title something like "data types of customs properties" or something like that. Forgive me for mixing up your issue with mine.

That said, even with that update for my problem I do not see a way to update a tag's custom property data type just yet. I do have that work around but still not a fan of it.