# System.tag.query history not fetching data

**URL:** <https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 30, 2022, 10:21am UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594 "2022-08-30T10:21:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 10:21am UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/1 "2022-08-30T10:21:05Z")

</div>

Hi using  
system.tag.storeTagHistory(histProv, tagProv, tags\_path, listing) to store tags data in Postgressql database

i have checked in database data are storing

But when i use **system.tag.query history to fetch the data its not fetching**

even i used tag history binding that also not working

Because i am using **system.tag.storeTagHistory** so that its not able to fetch the data?

can any one help me out

---

<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:** [August 30, 2022, 11:30am UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/2 "2022-08-30T11:30:33Z")

</div>

Wrong function, you are trying to use this, [system.tag.query - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.tag.query)

You need to use this,  
[https://docs.inductiveautomation.com/display/DOC81/system.tag.queryTagHistory](https://docs.inductiveautomation.com/display/DOC81/system.tag.queryTagHistory)

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/3 "2022-08-30T11:34:53Z")

</div>

yaa i am using [system.tag.queryTagHistory] i have mistakenly typed wrong. I have found the issue. tag provider name i have mentioned wrong. now its working

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 12:38pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/4 "2022-08-30T12:38:37Z")

</div>

Hi i am using tag history binding

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

i have data for same time multiple times. Any way to fix this?

---

<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:** [August 30, 2022, 12:50pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/5 "2022-08-30T12:50:14Z")

</div>

Are you sure the times are identical? You are only seeing to seconds. I bet if you look at ms they won’t be the same.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 12:56pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/6 "2022-08-30T12:56:29Z")

</div>

yes millisecond varies. I tired give return format Tall. I think that will fix right?

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 1:02pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/7 "2022-08-30T13:02:38Z")

</div>

You have any idea to fix that one?

---

<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:** [August 30, 2022, 1:20pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/8 "2022-08-30T13:20:43Z")

</div>

What exactly do you think should be fixed? How are you thinking the data should be presented?

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/9 "2022-08-30T16:07:23Z")

</div>

My question is i am using system.tag.storeTagHistory(histProv, tagProv, tags\_path, listing) to store data to database for 10 tags at same time.

But why ms seconds difference is occurring?

Is there anything i am doing wrong?

@paul-griffith your thoughts?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 30, 2022, 4:16pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/10 "2022-08-30T16:16:01Z")

</div>

Are you specifying the timestamps to use for storeTagHistory?

`system.tag.storeTagHistory(historyprovider, tagprovider, paths, values [, qualities, timestamps])`

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 4:16pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/11 "2022-08-30T16:16:25Z")

</div>

No i am not using timestamp

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 30, 2022, 4:18pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/12 "2022-08-30T16:18:41Z")

</div>

Perhaps you should, if you want them all to be the same. The historian works on a per-tag basis. Since it uses the current system time if it’s not specified, I can see where it would have a sub-second difference.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 4:19pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/13 "2022-08-30T16:19:10Z")

</div>

Any example to mention timestamp please

Timestamp = system.date.now() like that?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 30, 2022, 4:22pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/14 "2022-08-30T16:22:49Z")

</div>

Modified [from the manual](https://docs.inductiveautomation.com/display/DOC79/system.tag.storeTagHistory):

```python
"""
Stores multiple records for a single tag path. Could be modified to store more records by increasing the number of items in each list.
Additionally, different tag paths could be used for each record.
"""
  
paths = ["folder/tag","folder/tag"]     
values = [15, 300]
quals = [192] * len(paths)
dates = [system.date.now()] * len(paths)
  
# Store the history with the variables declared above.
system.tag.storeTagHistory("My History Provider", "My Tag Provider", paths, values, quals, dates)

```

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [August 30, 2022, 4:23pm UTC](https://forum.inductiveautomation.com/t/system-tag-query-history-not-fetching-data/63594/15 "2022-08-30T16:23:36Z")

</div>

Thanks i will implement and Check
