# How to get from historian the initial value of a tag at startTime and changes 'as stored' up to endTime

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793>\
**Category:** Ignition\
**Tags:** ignition83\
**Created:** [October 29, 2025, 5:17pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793 "2025-10-29T17:17:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Maurice\_Dubois](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jean-maurice_dubois/32/80996_2.png) [@Jean-Maurice\_Dubois](https://forum.inductiveautomation.com/u/Jean-Maurice_Dubois)\
**Post date:** [October 29, 2025, 5:17pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/1 "2025-10-29T17:17:29Z")

</div>

Hi,

How to get from historian the initial value of a tag at startTime and changes 'as stored' up to endTime?

In a single line of code if possible.

Thanks

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 29, 2025, 5:21pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/2 "2025-10-29T17:21:15Z")

</div>

Perhaps using something like

> **[system.historian.queryRawPoints | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.3/appendix/scripting-functions/system-historian/system-historian-queryRawPoints)**
>
> Queries raw data points for the specified historian.

---

<div class="post-metadata">

**Author:** ![Jean-Maurice\_Dubois](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jean-maurice_dubois/32/80996_2.png) [@Jean-Maurice\_Dubois](https://forum.inductiveautomation.com/u/Jean-Maurice_Dubois)\
**Post date:** [October 29, 2025, 5:23pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/3 "2025-10-29T17:23:30Z")

</div>

For exemple, I have a tag that has a value of 2 since 1st of september.

If I call queryRawPoints, and ask for values between yesterday and today. I get 0 for the value.

I tried setting to true includeBounds.. no changes

So the only way I see, is to call queryAggregatedPoints (with a 1 sec diff) and then call queryRawPoints for the range I’m checking.

Am I missing something?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 29, 2025, 5:28pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/4 "2025-10-29T17:28:52Z")

</div>

Are you getting a different value from calling `queryAggregatePoints`?

Share your tag's historical configuration. Also, show an example of the code you are using when getting 0 as a result from `queryRawPoints`.

---

<div class="post-metadata">

**Author:** ![Jean-Maurice\_Dubois](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jean-maurice_dubois/32/80996_2.png) [@Jean-Maurice\_Dubois](https://forum.inductiveautomation.com/u/Jean-Maurice_Dubois)\
**Post date:** [October 29, 2025, 5:38pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/5 "2025-10-29T17:38:57Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f4a3ec6a96c17bbdf3508ef01d56f368d9ca13fb.png)

how to get the initial value of PGM\_AUDIT\_0 and PGM\_AUDIT\_1?

(without making multiple call to api)

What I do understand, is that queryRawPoints, will give me the historian transactions that happen in the range I’m asking and not give me the way the tag evolved during the time range.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 29, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/6 "2025-10-29T17:52:34Z")

</div>

There's no magic wand. You have to query before your time range to get that starting value.

If you reliably set a max time between samples in your tag config, then that's how far back before your desired start you need to ensure you get enough samples.

If you only want to use one query, then you need to post process the result to

1. find the last sample before your start timestamp,
2. and deliver the rest of the samples as-is.

Sorry.

---

<div class="post-metadata">

**Author:** ![Jean-Maurice\_Dubois](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jean-maurice_dubois/32/80996_2.png) [@Jean-Maurice\_Dubois](https://forum.inductiveautomation.com/u/Jean-Maurice_Dubois)\
**Post date:** [October 29, 2025, 5:56pm UTC](https://forum.inductiveautomation.com/t/how-to-get-from-historian-the-initial-value-of-a-tag-at-starttime-and-changes-as-stored-up-to-endtime/111793/7 "2025-10-29T17:56:06Z")

</div>

It’s okay, I was wondering if I did not understood something right.

Would it be a good idea to have the API do this for us?

I imagine it’s something that everyone has to do frequently.

Thank you Phil
