# Opc tag value:

**URL:** <https://forum.inductiveautomation.com/t/opc-tag-value/4188>\
**Category:** General Discussion\
**Created:** [March 22, 2012, 6:57am UTC](https://forum.inductiveautomation.com/t/opc-tag-value/4188 "2012-03-22T06:57:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aliya](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Aliya](https://forum.inductiveautomation.com/u/Aliya)\
**Post date:** [March 22, 2012, 6:57am UTC](https://forum.inductiveautomation.com/t/opc-tag-value/4188/1 "2012-03-22T06:57:09Z")

</div>

After reading tag values in opc ua in ignition how to write these tag values in text file??? i need script for writing tag values in text file ![:prayer:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e5a7e3b63facc151ea73e3b45db7bdb3d4bdc316.gif ":prayer:")

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 22, 2012, 2:59pm UTC](https://forum.inductiveautomation.com/t/opc-tag-value/4188/2 "2012-03-22T14:59:43Z")

</div>

Sure, you can make a Timer Client Event Script that runs every x amount of time with a script like this:[code]from java.util import Date  
dateStr = system.db.dateFormat(Date(), “yyyy-MM-dd HH:mm:ss”)  
tag1 = system.tag.getTagValue(“Path/To/Tag1”)  
tag2 = system.tag.getTagValue(“Path/To/Tag2”)  
tag3 = system.tag.getTagValue(“Path/To/Tag3”)

system.file.writeFile(“C:\Filename.txt”, “%s,%s,%s,%s” % (dateStr, tag1, tag2, tag3), 1)[/code]That will append to the file every time with comma separated values.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 22, 2012, 3:03pm UTC](https://forum.inductiveautomation.com/t/opc-tag-value/4188/3 "2012-03-22T15:03:59Z")

</div>

If you want to use system.tag.getTagValues do the following:[code]from java.util import Date  
dateStr = system.db.dateFormat(Date(), “yyyy-MM-dd HH:mm:ss”)

tagPaths = [“Path/To/Tag1”, “Path/To/Tag2”, “Path/To/Tag3”]  
values = system.tag.getTagValues(tagPaths)

appendStr = “%s,” % dateStr  
for value in values:  
appendStr += “%s,” % str(value)  
appendStr = appendStr[:-1]

system.file.writeFile(“C:\Filename.txt”, appendStr, 1)[/code]
