[Bug-15466,15467,15471]Add New Tag 8.0

With regards to the tags, I’m passing the tag objects (fullPath, hasChildren, tagType, and name) to View parameter properties. I use the tag objects to know what data a view should use to populate the view.

Interesting that the label seems to do a great job of translating from the Java object to JSON, where the jsonEncode can’t. I was even thinking if there was a way to bind the output of the script to a label text, then bind the output of the label text to a Memory Tag, but didn’t know how to do that.

Oh, then you don’t even need jsonEncode.

rootTag = "[default]Experimentation"
self.custom.results = system.tag.browse(rootTag).getResults()

Screen Shot 2020-06-05 at 10.03.25 AM

Sorry, I wasn’t specific enough with my use-case. To clarify:

I am generating MenuTree content that will list pieces of equipment. For each item in the tree, I create a custom property “stationTagRoot” to contain the tag object (includes fullPath, etc) representing the root tag of that specific equipment. This way, an on-click script on the MenuTree can pass the stationTagRoot object to a View parameter, and the generic View can show data relevant to the specific equipment selected.

Trying to feed this MenuTree structure into a Document Memory tag isn’t working because the tag object can’t be converted into JSON natively. To work around this, instead of writing the tag object to the “stationTagRoot” property, I created a custom JSON object and filled in the relevant key:value pairs manually. For example, given “station” is the current tag object:

newStation = {'fullPath':str(station['fullPath']),'name':str(station['name'])}
stationItem = {"target":"","items":[],"navIcon":{"path":navIconPath,"color":"#6C6C6C"},"label":{"text":station['name'] + " - " +stationDesc ,"icon":{"path":""}},"visible":"true","enabled":"true","showHeader":"true","style":{"classes":""},'stationTagRoot':newStation}

This method is more manual than I prefer, but it works.

Given that the label component has no issues converting a tag object to a JSON format, is there any chance that the system.util.jsonEncode() could be made equally robust?