Vision labels get "serialization error" when displaying "document tag" values

I am performing regressions on various process data to better predict their outputs, thereby making it easier to detect issues with the processes.

I store the regression’s coefficient results in a dictionary because it makes pairing the coefficients and variables very simple and easy to read.

# Coefficients 
{
    "arc_length": 2.9178477439730455,
    "temperature": -0.009490811332843855,
    "intercept": 40.26487761444835,
    "velocity": -0.13768024624063155,
    "i_area": 0.03349375445769801
}

Between the calculation of the coefficients and their use in analysis, I currently store them in a tag of type “Document” because the dictionary can be stored and retrieved easily as a whole, at least with scripting it can.

While playing around with the math, I wanted to see the changes occur in real time, so I dropped a couple Label components on a Vision page and bound their Text properties to a couple of the Document tags. Although it worked in the sense that it displayed the json text for the dictionary, which was the aim of adding the labels, it will not allow me to SAVE the window. I get the following error:

SerializationException: Error during serialization for property 'interactionController' on object '[FPMIWindow]GraphTesting_Sawblade (multiball)'
	caused by SerializationException: Error during serialization for property 'propertyAdapters' on object '[DefaultInteractionController]com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController@7bb4fe5b'
	caused by SerializationException: Error during serialization for property 'expression' on object '[ExpressionPropertyAdapter] ---> lblResult 1'
	caused by SerializationException: Error during serialization for property 'children' on object '[FunctionExpression]com.inductiveautomation.ignition.common.expressions.FunctionExpression@27e8c75d'
	caused by SerializationException: Error during serialization for property 'tagListenerDelegate' on object '[BoundTagExpression]com.inductiveautomation.ignition.common.expressions.BoundTagExpression@1f5a190a'
	caused by SerializationException: Error during serialization for property 'tagQualifiedValue' on object '[TagListener]com.inductiveautomation.ignition.common.expressions.TagListener@6c9e1aa2'
	caused by SerializationException: Unable to create clean copy of class com.inductiveautomation.ignition.common.document.ExtendedDocument

How does one avoid this serialization issue when reading the value of a Document tag?

I’ve tried casting toStr(), and was originally using the following expression to get line breaks:

"<HTML>"+replace({doc_tag},",","<BR>")

Use jsonEncode to make a string. Elsewhere, make an actual document type custom prop.

Thanks for answering, Phil!

Use jsonEncode to make a string.

If you mean “Use jsonEncode to make a string to store in the Document tag”, that did not change the situation.

If you mean “Don’t use expressions with document tags”, well…perhaps not :frowning:

You probably meant “Use a tag of type “string” instead of type “document”, because using a ‘string’ type works, for sure.

Elsewhere, make an actual document type custom prop.

I don’t even see “document” as a valid property type in Vision.

jsonEncode is not an expression. It is a scripting function system.util.jsonEncode().

Create a custom Document property on your window's root container to bind to the document tag. Then use a propertyChange script, filtering for the document property, to convert the document using jsonEncode and push the returned string into the Label.

Thank you, too, lrose.

Yes, I know it is a python script function :smile: and I did use that to write a string to the document tag, instead of a dict() because I’m a good try-er!

I still cannot select “document” as a data type for a custom property. Please post a pic if you can!

What version of Ignition are you on?

This is from 8.1.48, not sure if they were added in 8.1.47 or .48

1 Like