# UDT Member Name on Custom Trend

**URL:** <https://forum.inductiveautomation.com/t/udt-member-name-on-custom-trend/83981>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [January 9, 2024, 5:11pm UTC](https://forum.inductiveautomation.com/t/udt-member-name-on-custom-trend/83981 "2024-01-09T17:11:04Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [January 12, 2024, 2:56pm UTC](https://forum.inductiveautomation.com/t/udt-member-name-on-custom-trend/83981/12 "2024-01-12T14:56:03Z")

</div>

Thanks. I was able to work one out on my own.

```auto
def customChartTagsDropped(self, paths):
	#headers - for reference
	#headers = [	'NAME', 'TAG_PATH', 'AGGREGATION_MODE',	'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'
	# ]
				
	#default row - configure as desired for default trend appearance
	defaultRow = ['Name', '[Provider]Path', 'MinMax', 'Default Axis',	1,
						True, 'color(255,0,0,255)',	'', 0, 1,
						0, True, False, '', False,
						False, False, True, '', True
				 ]
	
	#initialize empty tagPaths list
	tagPaths = []
	tagNamePaths = []
	
	#for each path in the list of dropped tags
	for path in paths:
	
		#each tag provider is formatted as "area_xx" find the first occurance of the tag provider name
		pathStartIndex = path.find("area_")
		
		#check for tag in the default provider if the "area" provider is not found
		if pathStartIndex == -1:
			pathStartIndex = path.find("default")
		
		#make sure provider was found
		if pathStartIndex != -1:
		
			#get the tag path from the proivder to the end and format to read the custom PenName property from the tag
			tagPath = "["+path[pathStartIndex:]+'.PenName'
			tagNamePath = "["+path[pathStartIndex:]+'.Name'
			
			#add the tagPath to the list
			tagPaths.append(tagPath)
			tagNamePaths.append(tagNamePath)
			
		#tag provider not found, append empty string to keep accurate parallel lists
		else:
			tagPaths.append('')
			
	penNames = system.tag.readBlocking(tagPaths)
	tagNames = system.tag.readBlocking(tagNamePaths)
	
	#for each pen name in the list of read pen names
	for count, penName in enumerate(penNames):
	
		#skip any tags where the provider was not found
		if tagPaths[count] != '':
		
			#create default row
			newRow = defaultRow
			
			#if PenName custom prop does not exist or is empty
			if penName.quality.isBad() or penName.value is None or str(penName.value) == '':
			
				#assign tag name row name
				newRow[0] = tagNames[count].value
				
			#good PenName found
			else:
			
				#assign PenName to row name
				newRow[0] = str(penName.value)
				
			#assign history path to row path
			newRow[1] = paths[count]
			
			#update tagPens with the new row
			self.tagPens = system.dataset.addRow(self.tagPens, self.tagPens.rowCount, newRow)

```

This script relies on the trended tag to have a custom `PenName` property that is used for the name. If it doesn't exist or is blank the tag name is used instead.

One way to improve this would be to create the `PenName` prop if it doesn't exist and prompt the user to fill it in, but most/all of the trended tags are part of a UDT so that could get hairy.

---

_[View the full topic](https://forum.inductiveautomation.com/t/udt-member-name-on-custom-trend/83981)._
