# Make pen name different than tag name from tag browser drag and drop

**URL:** <https://forum.inductiveautomation.com/t/make-pen-name-different-than-tag-name-from-tag-browser-drag-and-drop/98225>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [November 5, 2024, 5:04pm UTC](https://forum.inductiveautomation.com/t/make-pen-name-different-than-tag-name-from-tag-browser-drag-and-drop/98225 "2024-11-05T17:04:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yidir](https://avatars.discourse-cdn.com/v4/letter/y/35a633/32.png) [@yidir](https://forum.inductiveautomation.com/u/yidir)\
**Post date:** [November 5, 2024, 5:04pm UTC](https://forum.inductiveautomation.com/t/make-pen-name-different-than-tag-name-from-tag-browser-drag-and-drop/98225/1 "2024-11-05T17:04:02Z")

</div>

Vision 7.9  
When dragging and dropping tags from the tag browser to the pen list on an easy chart I don't get to edit the name. and because I use UDTs. All my tags have the same name. See below:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5c9257239720d3df547faee686da506b298da50f.png)

Is there a way i can change the pen name from the designer permanently?

---

<div class="post-metadata">

**Author:** ![kvane](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kvane/32/22228_2.png) [@kvane](https://forum.inductiveautomation.com/u/kvane)\
**Post date:** [November 5, 2024, 5:14pm UTC](https://forum.inductiveautomation.com/t/make-pen-name-different-than-tag-name-from-tag-browser-drag-and-drop/98225/2 "2024-11-05T17:14:07Z")

</div>

You will need to use Scripting. Take a look at the Scripting Functions User Manual Page for the component you are working with - [Easy Chart - Scripting Functions | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/7.9/appendix/components/charts/easy-chart/easy-chart-scripting-functions#ontagsdropped)

There is an example script that demonstrates:

```python
#This will take a tag that gets dropped from a Tag Browse Tree set in Realtime Tag Tree mode,
#and will replace the underscores in the name of the tag "_" and replace them with spaces.

```

---

<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:** [November 5, 2024, 5:47pm UTC](https://forum.inductiveautomation.com/t/make-pen-name-different-than-tag-name-from-tag-browser-drag-and-drop/98225/3 "2024-11-05T17:47:17Z")

</div>

I do this with custom properties on any tag that has history enabled.  
Custom property: `PenName`

```python
def customChartTagsDropped(self, paths):
	'''
		Add drag/dropped tag pen trend to easy chart from tag tree.
		
		Args:
			self (Easy Chart obj)	:	Easy chart object where tag history pens are to be displayed.
			paths (sting(s)) :	string (or list of string) tags to add to easy chart.
			
		Returns:
			n/a
			*self.tagPens	(dataset) :	Easy chart "tagPens" property is updated to included the added tag pen
	'''
	
	#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', 'Average', '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:
	
		#build tag path from historic tag path. 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 to row name
				newRow[0] = str(tagPaths[count].rsplit(']')[1][:-len('.PenName')])
				#newRow[0] = str(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)

```

You'll have to adjust this for your tag provider(s)
