Get historical path from tagpath

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

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?

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

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?

1 Like

system.tag.getConfiguration() is what you want, but you will need to construct the path.

1 Like

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…

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

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

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’.

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

There isn’t one.

1 Like
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.

6 Likes

Had no idea that existed.

1 Like

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…