# How to access the data accessed by Easy Chart \> Save button?

**URL:** <https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207>\
**Category:** Ignition\
**Created:** [March 25, 2014, 1:47am UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207 "2014-03-25T01:47:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreyaslimaye](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@shreyaslimaye](https://forum.inductiveautomation.com/u/shreyaslimaye)\
**Post date:** [March 25, 2014, 1:47am UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/1 "2014-03-25T01:47:10Z")

</div>

I have Ignition version 7.6.5. I have created an easy chart that plots the tag history data. When I click the save button on that easy chart, it saves the selected data in an excel file. I would like to store that data plus some other information into a MySQL table instead. So I need to create a button that would do a function similar to the ‘Easy Chart \> Save’ button plus some more.

Therefore, I want to know where is the tag history data behind the ‘Easy Chart \> Save’ button located so I can query it myself and store it in a MySQL table? Or alternatively, can I get the script behind the ‘Easy Chart \> Save’ button?

Thanks,

Shreyas

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [March 28, 2014, 4:49pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/2 "2014-03-28T16:49:37Z")

</div>

Hi Shreyas,  
The SQLTag history data is stored in database tables that start with sqlt\_.

Each SQLTag storing history is associated with a datasource in the designer. The datasource determines which database the history data is being stored to.

It may be easier to query the tag history data using the system.tag.queryTagHistory scripting function: [inductiveautomation.com/support/ … istory.htm](http://inductiveautomation.com/support/usermanuals/ignition/index.html?system_tag_querytaghistory.htm)

Nick

---

<div class="post-metadata">

**Author:** ![shreyaslimaye](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@shreyaslimaye](https://forum.inductiveautomation.com/u/shreyaslimaye)\
**Post date:** [April 7, 2014, 9:19pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/3 "2014-04-07T21:19:31Z")

</div>

Hello Nick,

Thank you for your suggestion to use system.tag.queryTagHistory scripting function. However, I am running into a problem using it.

I start with the following script.

startts = 1396395715  
stopts = 1396396003  
tagpath = “[VeecoIonMill]VEECO6/PMs/PM1/Trace Data/ActualRotationSpeed”  
print system.tag.exists(tagpath)  
print system.tag.read(tagpath).value

The print system.tag.exists(tagpath) statement returns a value of True. Also, the print system.tag.read(tagpath).value statement returns a value of 9.96. This tells me that my tagpath definition is correct and the tag.read function is giving me at least one correct value.

However, when I use the following statement, I get an error message attached in the file along with. It indicates that my definition of tagpath is incorrect.  
tracedata = system.tag.queryTagHistory(tagpath,startts,stopts)  
print tracedata

When I tweak the tracedata statement, to the following,  
tracedata = system.tag.queryTagHistory(‘tagpath’,startts,stopts)  
print tracedata

I get the following result for print tracedata statement Dataset [0R ? 8C] - indicating no data.

What am I doing wrong? How should I define the tagpath in the system.tag.queryTagHistory function to get the result correctly?

Thanks,

Shreyas

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [April 7, 2014, 9:45pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/4 "2014-04-07T21:45:23Z")

</div>

Hi Shreyas,

You need to be sure that you are using the data types that the system.tag.queryTagHistory function expects to receive.

The paths parameter is a PySequence of strings. The startDate and endDate parameters are the type Date.

A Python list is a PySequence so you could put your string tag path in a Python list and use that as the argument for paths.

Here is an example script:

```auto
from java.util import Date
tagpath = "[factory]VEECO6/PMs/PM1/Trace Data/ActualRotationSpeed"
#create a list with one tag path
paths = [tagpath]
#get date objects from epoch time
startts = Date(1390395715 * 1000)
stopts = Date(1396396003 * 1000)
tracedata = system.tag.queryTagHistory(paths,startts,stopts)
```

---

<div class="post-metadata">

**Author:** ![shreyaslimaye](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@shreyaslimaye](https://forum.inductiveautomation.com/u/shreyaslimaye)\
**Post date:** [April 8, 2014, 4:59pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/5 "2014-04-08T16:59:56Z")

</div>

Hello Nick,

Thanks once again! I tried your code and when I use the print tracedata command at the end of the code, it does give me the following result: Dataset [4824R ? 2C]

I wanted to check the contents of the array. So I added the following code.  
for row in tracedata:  
for col in row:  
print tracedata[row][col]

However, that gives me the error shown in screen capture 1.

Question 1: What command can I use to view the contents of the array tracedata?

Also, I want to be able to get all the tags selected in the easy chart. If I use the following script, I can get all the tags defined within [VeecoIonMill]VEECO6/PMs/PM1/Trace Data. However, I want to get only those that are selected as shown in screen capture 2.

equipment = ‘VEECO6’  
pm = ‘PM1’  
folderPath = “[VeecoIonMill]”+equipment+"/PMs/"+pm+"/Trace Data"  
folder = system.tag.browseTags(folderPath)

Question 2: What can I do to get only the selected tags?

I tried to use the folder defined above in the system.tag.queryTagHistory command as shown below.  
tracedata = system.tag.queryTagHistory(folder,startts,stopts)  
But I guess I am making the same mistake of not using the PyDataset.

Question 3: How can I convert the list of selected tags into the PyDataset that I can use in the system.tag.queryTagHistory command?

Thanks,

Shreyas

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [April 18, 2014, 5:33am UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/6 "2014-04-18T05:33:10Z")

</div>

Hi Shreyas,

Here is the code for your first question. First it prints all the column names in tracedata. Then it prints each row in tracedata:

```auto
columns = tracedata.getColumnNames()
print columns
tracedata = system.dataset.toPyDataSet(tracedata)
for row in tracedata:
	for column in columns:
		print str(row[column])+",",
	print
```

The following code answers your second and third questions. Instead of getting the paths from a SQLTags folder the code gets the selected tags from the Easy Chart itself. The tagPaths variable contains a data structure that can be used by the system.tag.queryTagHistory function.

You may need to change the line of code that has the component path to the Easy Chart. If needed, change it to use the location and name that you are using for the Easy Chart in your project.

```auto
easyChart = event.source.parent.getComponent("Easy Chart")
tagPaths = []
for row in system.dataset.toPyDataSet(easyChart.tagPens):
	if row["ENABLED"] == True:
		tagPaths.append(row["TAG_PATH"])

tracedata = system.tag.queryTagHistory(tagPaths,startts,stopts)
```

---

<div class="post-metadata">

**Author:** ![shreyaslimaye](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@shreyaslimaye](https://forum.inductiveautomation.com/u/shreyaslimaye)\
**Post date:** [April 23, 2014, 10:58pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/7 "2014-04-23T22:58:40Z")

</div>

Hello Nick,

Thank you very much for responding to my questions! I tried using your solution. I am able to view the contents of the array tracedata, I can get only the selected tags and I can convert the list of selected tags to PyDataSet using the code you suggested.

easyChart = event.source.parent.getComponent(“Easy Chart”)  
tagPaths = []  
for row in system.dataset.toPyDataSet(easyChart.tagPens):  
if row[“ENABLED”]:  
tagPaths.append(row[“TAG\_PATH”])

tracedata = system.tag.queryTagHistory(tagPaths,startts,stopts)  
print tracedata  
columns = tracedata.getColumnNames()  
print columns  
tracedata = system.dataset.toPyDataSet(tracedata)  
for row in tracedata:  
for column in columns:  
print str(row[column])+",",  
print

However, I am not getting the same result as the Save function on the Easy Chart does. For example, the easy chart for one of the signals is as shown in image 1.

When I click on the Save button and save the data in excel, the data I see is as shown in image 2. Even when the data is unchanged, I do see those values using the Save button.

However, when I use the code, I get only the following 11 points as shown in image 3. This data is really small compared to the data I get using the Save button for easy chart. How can I extract the same data as the save button?

I want to store all the data that gets stored by the Save button plus some other information into a MySQL table instead. So I need to create a button that would do a function similar to the ‘Easy Chart \> Save’ button plus some more.

---

<div class="post-metadata">

**Author:** ![ktz78](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@ktz78](https://forum.inductiveautomation.com/u/ktz78)\
**Post date:** [December 18, 2014, 2:38pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/8 "2014-12-18T14:38:41Z")

</div>

Hello shreyaslimaye,

Did you find-out a solution?

Regards,

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [January 30, 2015, 5:16pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/9 "2015-01-30T17:16:05Z")

</div>

Ignition 7.7.3-rc1 has come out with an easyChart.exportDatasets() method that exports the time series data to datasets which can then be inserted into a database or put anywhere.

Find out more about it in this forum topic: [inductiveautomation.com/for … 92&t=13508](https://www.inductiveautomation.com/forum/viewtopic.php?f=92&t=13508)

Best,

---

<div class="post-metadata">

**Author:** ![lrhyrne](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrhyrne/32/12097_2.png) [@lrhyrne](https://forum.inductiveautomation.com/u/lrhyrne)\
**Post date:** [September 17, 2019, 2:37pm UTC](https://forum.inductiveautomation.com/t/how-to-access-the-data-accessed-by-easy-chart-save-button/8207/10 "2019-09-17T14:37:50Z")

</div>

shreyaslimaye,

I am curious as well. how did you execute your custom script from the EasyChart’s save button?
