# Get historical path from tagpath

**URL:** <https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128>\
**Category:** Ignition\
**Created:** [May 2, 2022, 5:58pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128 "2022-05-02T17:58:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [May 2, 2022, 5:58pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/1 "2022-05-02T17:58:58Z")

</div>

Is there a native scripting function or otherwise a way to supply a tagpath and get returned its historical path

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [May 2, 2022, 6:06pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/2 "2022-05-02T18:06:00Z")

</div>

What do you mean by historical tag path?

I am not an expert here, but I don’t think that’s a “correct” term. Tag history doesn’t get stored in a tag, so there should be no historical tag path. (I could be wrong). Tag history gets stored in a database via the historian.

What exactly are you trying to do?

---

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [May 2, 2022, 6:10pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/3 "2022-05-02T18:10:47Z")

</div>

something that looks like so…  
histprov:BM\_CX:/drv:ma-ign-io-a1:default:/tag:flr\_0/erb02/batty/tm\_ups\_1a\_1/temp\_01\_c

Like what the tag tree provides in the powerchart

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [May 2, 2022, 6:12pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/4 "2022-05-02T18:12:16Z")

</div>

But why? Like for a report, alarm, store in another tag, like what’s your end game? If you had it, what would you be doing with it?

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 2, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/5 "2022-05-02T18:14:52Z")

</div>

[system.tag.getConfiguration()](https://docs.inductiveautomation.com/display/DOC81/system.tag.getConfiguration) is what you want, but you will need to construct the path.

---

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [May 2, 2022, 6:18pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/6 "2022-05-02T18:18:08Z")

</div>

i am adding-on to the ad-hoc chart... I am just constructing the string... but idk it isnt working.. i thought maybe it had to be lowercase... because that is the source path the tree generates a lowercase string.. But i am scripting my pen objects and they look just like the ones i drag and drop from the tree..

> [@josborn](#):
>
> [system.tag.getConfiguration()](https://docs.inductiveautomation.com/display/DOC81/system.tag.getConfiguration) is what you want, but you will need to construct the path.

I was looking at this but tagHistoryPath or what ever we shall call it isnt a prop of a tag?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [May 2, 2022, 6:18pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/7 "2022-05-02T18:18:36Z")

</div>

Probably a better way to build it, but I have used this before, `pyData` is a list of tag paths

```auto
for row in pyData:
	prov = re.search(r"(?<=\[).+?(?=\])",str(row['Tag'])).group()
	tag = re.sub(r"\[[^()]*\]", "", str(row['Tag']))
	alarm = row['Alarm']
	sourcePath = 'prov:'+prov+':/tag:'+tag+':/alm:'+alarm

```

Edit, to clarify, `pyData` is the results from a table with columns ‘Tag’, ‘Alarm’.

---

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [May 2, 2022, 6:22pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/8 "2022-05-02T18:22:29Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d96c8045c096af26cf22889dbaa2553107e4a61e.png)

I am doing this more or less… I am looking for a baked in method…

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 2, 2022, 6:23pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/9 "2022-05-02T18:23:04Z")

</div>

There isn’t one.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 2, 2022, 6:31pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/10 "2022-05-02T18:31:31Z")

</div>

```auto
from com.inductiveautomation.ignition.common import QualifiedPath, WellKnownPathTypes

qp = QualifiedPath.Builder()
	.set(WellKnownPathTypes.HistoryProvider, "provider")
	.setDriver("driver")
	.setTag("path/to/tag")
	.build()
	.toString()

```

Doesn’t really buy you much over joining the string parts together yourself.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 2, 2022, 6:32pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/11 "2022-05-02T18:32:31Z")

</div>

Had no idea that existed.

---

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [May 2, 2022, 6:33pm UTC](https://forum.inductiveautomation.com/t/get-historical-path-from-tagpath/59128/12 "2022-05-02T18:33:30Z")

</div>

dude you’re awesome and right… I was dumb and didnt cut the “[default]” out the [fullPath] and ran to the forms to soon lol but i am glad i asked…
