# Would like to add a Tag Name Alias

**URL:** <https://forum.inductiveautomation.com/t/would-like-to-add-a-tag-name-alias/92369>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 25, 2024, 10:19pm UTC](https://forum.inductiveautomation.com/t/would-like-to-add-a-tag-name-alias/92369 "2024-06-25T22:19:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [June 25, 2024, 10:19pm UTC](https://forum.inductiveautomation.com/t/would-like-to-add-a-tag-name-alias/92369/1 "2024-06-25T22:19:22Z")

</div>

Just wondering if this sounds reasonable.

I currently have script that creates a `Tag Path`, `History` and `POST` dataset. I'm wondering where would be the best place (if any) to replace the tag name before the POST is sent out with an alias tag name.

The `Tag Path` has the paths to tags that need to be POSTed.

The `History` dataset is created with `Tag Path` dataset and the `system.tag.queryTagHistory` function.

Then the `POST` dataset is created by breaking up each row of the `History` dataset in to JSON format with each of the key values needed. Currently it splits the tag name out of each row in the `History` dataset.

I can add a custom property `Alias Name` in each tag and read it with the `system.tag.readBlocking` function. I was wondering if I could create a forth dataset with all the `Alias Name` custom property values. Then I could reference it for the tag name when creating the `POST` dataset instead of referencing the `History` dataset.

I fear that reading all the `Alias Name` properties from each tag could cause overhead issues when POSTs are sent out.

Another issue is setting up the `Alias Name`. I have a script to create UDT instances from a CSV file with the `system.tag.configure` function but if I need to change the `Alias Name` custom property, it seems like it would be best to just make that change in the parent UDT as long as they are the same in each UDT instance.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [June 25, 2024, 10:47pm UTC](https://forum.inductiveautomation.com/t/would-like-to-add-a-tag-name-alias/92369/2 "2024-06-25T22:47:47Z")

</div>

Can you post your script so we can see what it is currently doing?

---

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [June 26, 2024, 7:14pm UTC](https://forum.inductiveautomation.com/t/would-like-to-add-a-tag-name-alias/92369/3 "2024-06-26T19:14:40Z")

</div>

It's a bit of mess and I (mostly) know not, what I do. 🙂

For testing, I changed the line getting the 'point' key value and it is working, but getting the alias here means it's checking for every value found for every tag, and the POST is happening every few minutes.

The idea was to make an `AliasName` list from the `Tag Path` list, but it would not have the same number of items/rows as the `History` list used to create the `newPOST` list.

I can't just replace the `point` key value line  
`history.getValueAt(rowIndex, 0).split('/')[-1]`  
with  
`AliasName.getValueAt(rowIndex, 0)`.

I can try it like it is, checking every item in the `History` list or maybe see if I can make a script function to check each path in the `Tag Path` list. If it has a tag name alias, search for that same path in the `History` list and replace all the instances of it with the alias tag name. Not sure how much that would help efficiency.

Check all tags in the `Tag Path` list, even if a tag has no historical data, and then try to search and replace all those in the `History` list, lets say 1000 tags or check all the tags that had historical data and made it into the `History` list, lets say 100 tags with 10 samples for each.

```python
	for rowIndex in range(history.getRowCount()):
			path_parts = history.getValueAt(rowIndex, 0).split('/')
			newPOST.extend(
				[
					{
						'system': findEquals(System_subSystem_Dataset, "[default]" + history.getValueAt(rowIndex, 0), 'System_ID'),
						'subSystem': findEquals(System_subSystem_Dataset, "[default]" + history.getValueAt(rowIndex, 0), 'subSystem_ID'),
						'equipment': path_parts[-2],
						#'point': history.getValueAt(rowIndex, 0).split('/')[-1], # Get the tag name after the last '/'
						'point': system.tag.readBlocking(["[default]" + str(history.getValueAt(rowIndex, 0)) + ".Alias Name"])[0].value,
						'timestamp': str(system.date.fromMillis(history.getValueAt(rowIndex, 3).getTime()).toInstant()), # Convert timestamp to UCT
						'value': history.getValueAt(rowIndex, 1)
					}
				]
			)

```
