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)
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.
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:
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.