# Help need on Ignition historian query

**URL:** <https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780>\
**Category:** Ignition\
**Created:** [January 7, 2022, 6:45pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780 "2022-01-07T18:45:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 7, 2022, 6:45pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/1 "2022-01-07T18:45:46Z")

</div>

Hi,  
I try to show some related boolean events in a table so I use As stored tag history binding as shown below but I get multiple rows with the same timestamp.  
Why do we this some behaviour?  
Is there any workaround to force ignition historian merge values in a single row for the same timestamp?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c79ebd010d022a63241cff0640e6caf054f749cf.png)

---

<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:** [January 10, 2022, 4:12am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/2 "2022-01-10T04:12:43Z")

</div>

Not sure how this is possible since the timestamp is part of the key, at least I thought it was.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 11, 2022, 3:31am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/3 "2022-01-11T03:31:36Z")

</div>

Yes really strange and annoying

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 11, 2022, 4:31am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/4 "2022-01-11T04:31:18Z")

</div>

I’m assuming that probably the problem is in how you are converting the Unix time to human readable.  
Did you add a transform after the shown binding?  
If you did for some reason, you should use [`system.date.fromMillis()`](https://docs.inductiveautomation.com/display/DOC81/system.date.fromMillis).

Another possible problem is the date format you’re giving to the column prop, especially for the millis part has the wrong pattern. If so, which format are you using?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 11, 2022, 8:18pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/5 "2022-01-11T20:18:24Z")

</div>

I dont use any convert for time format and only use table column format for displaying. Even without it the millis value is the same

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 11, 2022, 8:32pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/7 "2022-01-11T20:32:23Z")

</div>

> [@jespinmartin1](#):
>
> especially for the millis part has the wrong pattern. If so, which format are you using?

How the pattern looks?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 11, 2022, 8:33pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/8 "2022-01-11T20:33:36Z")

</div>

> [@jespinmartin1](#):
>
> or the millis part has the wrong pattern. If so, which format are you using

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/c/9c90cb27ea6bcbdb715faac2f3b2a6d1ebab8bc6.png)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 11, 2022, 8:34pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/9 "2022-01-11T20:34:26Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e0f98f992650703217f6c96cc00be0f3af9b74d.png)  
Simple as stored binding

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 11, 2022, 8:36pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/10 "2022-01-11T20:36:34Z")

</div>

This is a known limitation/behavior of the historian. You’ll have to manually collapse the rows with a script.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 11, 2022, 8:39pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/11 "2022-01-11T20:39:46Z")

</div>

Can you guide me with a simple python example of how to merge them?

---

<div class="post-metadata">

**Author:** ![matt.eaton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matt.eaton/32/72046_2.png) [@matt.eaton](https://forum.inductiveautomation.com/u/matt.eaton)\
**Post date:** [January 11, 2022, 9:16pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/12 "2022-01-11T21:16:46Z")

</div>

I notice that the data is different between the timestamps if I’m reading this correctly. If you compressed them with a script how would you figure out which data points are correct?

For the tags themselves, are you storing with Auto/Analog or Discrete mode?

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 11, 2022, 10:14pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/13 "2022-01-11T22:14:32Z")

</div>

Ohh, that explains that time I tried…

Thanks for the clarification.  
I was about to tell him to avoid millis precision

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 12, 2022, 5:33am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/14 "2022-01-12T05:33:46Z")

</div>

No there are times that they have the same time stamp but it returns a different row.  
Look at the first post

> [@Help need on Ignition historian query](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780):
>
> Hi, I try to show some related boolean events in a table so I use As stored tag history binding as shown below but I get multiple rows with the same timestamp. Why do we this some behaviour? Is there any workaround to force ignition historian merge values in a single row for the same timestamp?

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [January 13, 2022, 10:05am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/15 "2022-01-13T10:05:40Z")

</div>

I think this happens because you have three tags, (3 columns). duplicate timestamps correspond to different tags. try putting just one tag

---

<div class="post-metadata">

**Author:** ![paul.nelson](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@paul.nelson](https://forum.inductiveautomation.com/u/paul.nelson)\
**Post date:** [January 14, 2022, 3:13pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/16 "2022-01-14T15:13:34Z")

</div>

Also, you could try for special cases like this to use ‘system.tag.storeTagHistory’ , it allows you to specify a timestamp so you can control the value when this is loaded to history. We use this to get values on exact top of the hour for statutory reporting. **system.tag.storeTagHistory(historyprovider, tagprovider, paths, values [, qualities, timestamps])**

- Parameters

String historyprovider - The historical provider to store to.

String tagprovider - The name of the realtime tag provder to associate these tags with. The tag provider does not need to exist, and the tag paths do not need to exist in it.

List paths - A list of paths to store. The values, qualities, and timestamps are one-to-one with the paths. A single path may be present multiple times in order to store multiple values.

List values - A list of values to store.

List qualities - A list of integer quality codes corresponding to the values. Quality codes can be found on the [Quality Codes and Overlays](https://docs.inductiveautomation.com/display/DOC81/Quality+Codes+and+Overlays) page. If omitted, GOOD quality will be used. [optional]

List timestamps - A list of Date timestamps corresponding to the values. If omitted, the current time will be used. A java.util.date object may be passed, so the [system.date](https://docs.inductiveautomation.com/display/DOC80/system.date) funcitions can be used to return a timestamp. [optional]

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 15, 2022, 2:51am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/17 "2022-01-15T02:51:29Z")

</div>

The problem is I have over 200 UDTs and it is easy to just enable historian on them

---

<div class="post-metadata">

**Author:** ![paul.nelson](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@paul.nelson](https://forum.inductiveautomation.com/u/paul.nelson)\
**Post date:** [January 17, 2022, 4:56pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/18 "2022-01-17T16:56:33Z")

</div>

Do you mean 200 UDT instances; or 200 UDT types? if instances, then ‘system.tag.storeTagHistory’ may be easily included in the UDT type script, that way you can have the proper behavior for time stamp as you design for all UDT’s.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 18, 2022, 10:07am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/19 "2022-01-18T10:07:19Z")

</div>

Yes it is good idea thanks

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [January 26, 2022, 8:26am UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/20 "2022-01-26T08:26:10Z")

</div>

Hi Paul,

Look at this script that I manually insert value into historian with the same timestamp but as you see it return 2 separate rows with the same t\_stamp which is undesired.

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

---

<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:** [January 30, 2022, 12:39pm UTC](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780/21 "2022-01-30T12:39:20Z")

</div>

One thing not mentioned is how you want to handle these cases. Last value wins? Values ORed together?

[Next page](https://forum.inductiveautomation.com/t/help-need-on-ignition-historian-query/54780.md?page=2)
