Documentation in Tag Browse Tree

I am using the ‘tag browse tree’ object to allow dragging/dropping of tags onto an easychart, but the tree only displays the tagname, which is Greek to a customer. Is there a way to display the tag documentation (ie:description) in the tree instead, or even alongside the tagname would be great. I have a label object that shows the documentation of the selected tag in the tree, but a customer would still have to scroll through each tag, looking at the description until they find what they are looking for. Thanks for any help.

Use the onTagsDropped extension function in Easy Chart. I will typically create a folder called ‘metadata’ that has ‘description’ and ‘short description’ string tags. The metadata folder is a sibling to the value we’ll be trending. We use ‘short description’ for the name field in easy chart.

On tag drop, you’ll read the ‘short description’ of the tag and write it into the name field in the easy chart component.

If you need an example, let me know and I’ll write something up real quick.

Good luck!

Here’s some example code I put together… it works but you might want to play around with it… this goes on the ‘onTagsDropped’ extension function on the Easy Chart.

Add a sibling folder to your tag called ‘metadata’, create a memory tag, string type, in the folder called shortDescription. This description is what you want your pen description to be in Easy Chart.

[code] ‘’‘create the headers for dataset to write into tagPens on easy chart’’’
headers = [‘NAME’, ‘TAG_PATH’, ‘AGGREGATION’, ‘AXIS’, ‘SUBPLOT’, ‘ENABLED’, ‘COLOR’, ‘DASH_PATTERN’, ‘RENDER_STYLE’, ‘LINE_WEIGHT’, ‘SHAPE’, ‘FILL_SHAPE’, ‘LABELS’, ‘GROUP_NAME’, ‘DIGITAL’, ‘OVERRIDE_AUTOCOLOR’, ‘HIDDEN’, ‘USER_SELECTABLE’, ‘SORT_ORDER’, ‘USER_REMOVABLE’]

'''because we're only dropping one tag, there will only be one pen in the list'''
for path in paths:
	indx = path.rfind('/') #find the last forward slash
	new = str(path[:indx]) + '/metadata/shortDescription' #add the short description path to the new path
	name = system.tag.read(new).value #read the value of the short description
	path = path.replace('[default]', '[DB]') #replace default with DB--this is for the historical provider path... replace with the name of your historical provider, mine is called DB
	
	'''below are the values we will add into the row for this pen'''
	values = [[name, path, 'MinMax', 'Default Axis', 1, 1, 'FF5555', '', 1, 1, 0, 1, 0, '', 0, 0, 0, 1, 0, 1]]
data = system.dataset.toDataSet(headers, values) #create the dataset with headers and values to write to the tagPens on the Easy Chart


self.tagPens = data #write to tagPens and now short description takes the place of the tag name in the chart
	[/code]

The short description takes the place of tag.name in the ‘Name’ column for your pen.

Good Luck!

We couldn’t spend too much time on this so I ended up finding a fairly simple solution. Along with the Tag Tree Browser I included a text label bound to the selected tags Documentation dotfield:

tag(concat({Root Container.Container.Label.tag_path}, ".Documentation"))

This displays the tags description in a text label. Also, below the actual EasyChart I placed eight text labels, each one bound to the Documentation dotfield of chart pens. Each label is colored to match the pen colors on the chart for identification:

try(" " + {Root Container.Easy Chart.tagPens}[0,0] + "     " +tag(concat(toStr({Root Container.Easy Chart.tagPens}[0,1]),".Documentation")), " No Pen Assigned")

I had to put a TRY function in there to keep the label from going into error whenever one of the pen slots was empty.

The only thing I need to do now is find a way to limit the number of tags the customer can drop onto the chart. The Tag Browse Tree does not have an Enabled/Disabled property, so I’ll have to think it over.

If someone else is looking for something similar, I used the code above as a starting point, but I used the Tooltip property of the tags for the location of the actual name. My code also allows for multiple tags to be added on a trend. (Though they still have to be added one at a time.)

[code]## Create the headers for dataset to write into tagPens on easy chart
headers = [‘NAME’, ‘TAG_PATH’, ‘AGGREGATION’, ‘AXIS’, ‘SUBPLOT’, ‘ENABLED’, ‘COLOR’, ‘DASH_PATTERN’, ‘RENDER_STYLE’, ‘LINE_WEIGHT’, ‘SHAPE’, ‘FILL_SHAPE’, ‘LABELS’, ‘GROUP_NAME’, ‘DIGITAL’, ‘OVERRIDE_AUTOCOLOR’, ‘HIDDEN’, ‘USER_SELECTABLE’, ‘SORT_ORDER’, ‘USER_REMOVABLE’]

## Get Current Data Set
data = self.tagPens

## Doesn't matter how many tags we drop. They should all read.
for path in paths:
	name = system.tag.read(path + ".Tooltip").value #read the value of the short description
	
	#below are the values we will add into the row for this pen
	values = [name, path, 'MinMax', 'Default Axis', 1, 1, 'FF5555', '', 1, 1, 0, 1, 0, '', 0, 0, 0, 1, 0, 1]
	data = system.dataset.addRow(data, values) # Add that pen to the list. If Auto Color is set the tags should all be different colors.
self.tagPens = data #write to tagPens and now short description takes the place of the tag name in the chart[/code]
1 Like