# Extracting tag name though script?

**URL:** <https://forum.inductiveautomation.com/t/extracting-tag-name-though-script/61562>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [July 6, 2022, 2:25pm UTC](https://forum.inductiveautomation.com/t/extracting-tag-name-though-script/61562 "2022-07-06T14:25:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dean\_Walsh](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dean\_Walsh](https://forum.inductiveautomation.com/u/Dean_Walsh)\
**Post date:** [July 6, 2022, 2:25pm UTC](https://forum.inductiveautomation.com/t/extracting-tag-name-though-script/61562/1 "2022-07-06T14:25:41Z")

</div>

Hello, i am trying to get an event log to update through a tag change script on the folder, this is fine but i cannot figure out how to extract the tag name and the state. Essentially what i want to do it this

> Blockquote  
> rootPath = '[default]DTL\_Ramps/Ramp PLC Connection Tags/Ramp1/Event'  
> tags = system.tag.browse(rootPath)  
> values = [i['value'].value for i in tags]  
> if (any(values)) != 0:  
> Parameters = system.tag.readBlocking(values.TagName+Value)  
> system.db.runNamedQuery("EventLog", Parameters)

So if any event turns on i want to grab the name of it and run it through a query as a parameter,  
would appreciate if anybody had the knowledge to share.

---

<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:** [July 6, 2022, 2:45pm UTC](https://forum.inductiveautomation.com/t/extracting-tag-name-though-script/61562/2 "2022-07-06T14:45:53Z")

</div>

See this thread:

> [@Gateway timer script to log folder of tags to SQL](https://forum.inductiveautomation.com/t/gateway-timer-script-to-log-folder-of-tags-to-sql/61180/22):
>
> EDIT: What specific version of Ignition are you using? That hasn’t been stated, yet. getResults() should work regardless. Let’s start small and work our way up. This is a sample using my server, change to your tag path and see if we can print some values from the script console. tagPath = '[default]Assembly/3425/Production' # Browse for tags in a Folder tags = system.tag.browse(tagPath, {'tagType' : 'AtomicTag'}).getResults() # Initialize list of tags to read tagReadList = [] # Add fullpath…

Are you wanting to do this on a tag valueChange event or on a Tag Change event in the gateway?

I would probably avoid running a script like this in a valueChange event. A long running script (longer than ~100ms) can result in missed events do to the way that valueChange events work.

---

<div class="post-metadata">

**Author:** ![Dean\_Walsh](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dean\_Walsh](https://forum.inductiveautomation.com/u/Dean_Walsh)\
**Post date:** [July 6, 2022, 2:46pm UTC](https://forum.inductiveautomation.com/t/extracting-tag-name-though-script/61562/3 "2022-07-06T14:46:48Z")

</div>

its on a gateway tag change event looking at the whole events folder
