# Retrieve time stamp last time a tag (integer) equaled a value

**URL:** <https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 16, 2025, 7:18pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532 "2025-10-16T19:18:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpomerhn](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bpomerhn](https://forum.inductiveautomation.com/u/bpomerhn)\
**Post date:** [October 16, 2025, 7:18pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/1 "2025-10-16T19:18:17Z")

</div>

V8.1-Perspective

What is the easiest way to display the time and date, the last time a tag (integer) equaled a certain value?

I’ve watched EDU videos and I’m still stumped.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 16, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/2 "2025-10-16T19:33:53Z")

</div>

How and where have you stored the tag data?

What are EDU videos?

---

<div class="post-metadata">

**Author:** ![bpomerhn](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bpomerhn](https://forum.inductiveautomation.com/u/bpomerhn)\
**Post date:** [October 16, 2025, 7:36pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/3 "2025-10-16T19:36:58Z")

</div>

I have stored the values in my storage provider, a MSSQL DB.

Sorry, the university videos or videos from the manual.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 16, 2025, 7:39pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/4 "2025-10-16T19:39:48Z")

</div>

**How**... have you stored the tag data?

Are you using the Ignition Historian, transaction groups or tag events?

---

<div class="post-metadata">

**Author:** ![bpomerhn](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bpomerhn](https://forum.inductiveautomation.com/u/bpomerhn)\
**Post date:** [October 16, 2025, 7:40pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/5 "2025-10-16T19:40:18Z")

</div>

Historian

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 16, 2025, 7:41pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/6 "2025-10-16T19:41:08Z")

</div>

OK. Let's see your tag's history configuration.

---

<div class="post-metadata">

**Author:** ![bpomerhn](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bpomerhn](https://forum.inductiveautomation.com/u/bpomerhn)\
**Post date:** [October 16, 2025, 7:46pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/7 "2025-10-16T19:46:42Z")

</div>

| Column 1 | Column 2 | Column 3 | Column 4 |
| --- | --- | --- | --- |
| History Enabled | true | | |
| Storage Provider | IGNITION\_HIST | | |
| Deadband Style | Auto | | |
| Deadband Mode | Absolute | | |
| Historical Deadband | 0.01 | | |
| Sample Mode | OnChange | | |
| Min Time Between Samples | 10 | | |
| Min Time Units | SEC | | |
| Max Time Between Samples | 1 | | |
| Max Time Units | HOUR | | |

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 16, 2025, 8:09pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/8 "2025-10-16T20:09:49Z")

</div>

A few notes:

1. You should probably change the `Deadband Style` to Discrete.
2. If the tag value is an Integer then it can not have a change of 0.01 so esentially you have this set for no deadband. Not necessarily an issue, but just wanted to note.
3. `Min Time Between Samples` causes records **not** to be recorded for at least 10 seconds, so any changes that occur will be lost. If what you are trying to achieve is to insure you have a record every 10 seconds, then that would be the `Max Time Between Samples` setting.

The easiest method would be to set up a Tag History Binding with the Aggregation Mode set to `Last Value`.

> **[Tag History Bindings in Perspective | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/bindings-in-perspective/tag-history-bindings-in-perspective#tag-history-binding)**
>
> Tag History Binding

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [October 16, 2025, 8:12pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/9 "2025-10-16T20:12:59Z")

</div>

Playing around with AI, so haven’t vetted it:

```python
tagPath = "[default]Area1/Motor1/Speed"
start = system.date.addHours(system.date.now(), -1)
end = system.date.now()

data = system.tag.queryTagHistory(
    paths=[tagPath],
    startDate=start,
    endDate=end,
    returnSize=-1
)

# Filter occurrences where value == desired value
valueToFind = 1200
matches = [row for row in data if row['value'] == valueToFind]

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 16, 2025, 9:44pm UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/10 "2025-10-16T21:44:27Z")

</div>

> [@lrose](#):
>
> The easiest method would be to set up a Tag History Binding with the Aggregation Mode set to `Last Value`.

This aggregate mode simply says, if there are multiple values within the sample period, take the last / most recent value.

For something like this, you probably **don't** want to aggregate or sample it at all, you want the raw data points (that is, what @robertm has already with `returnSize=-1`)

---

<div class="post-metadata">

**Author:** ![bpomerhn](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bpomerhn](https://forum.inductiveautomation.com/u/bpomerhn)\
**Post date:** [November 28, 2025, 7:18am UTC](https://forum.inductiveautomation.com/t/retrieve-time-stamp-last-time-a-tag-integer-equaled-a-value/111532/11 "2025-11-28T07:18:46Z")

</div>

I was able to revisit this, finally.

I ended up doing a tag history binding to the props.data property of a table. The configuration for the tag history binding was wide return format, as stored query mode, realtime with an appropriate range needed to see the value, direct historian tag reference.

I then filtered the column with the integer value in it equal to the value I was looking for, formatted the timestamp column with correct time/date format, and made header, pager and value columns invisible/disabled. I then further formatted the remaining cell to look like a display label, which is all I needed.

I was able to then copy this for each tag I needed, making sure to change the column field for each unique tag and it worked great. I had a good comparison from a different HMI and all my time stamps were 2-3s ahead of the other HMI.

I’m sure there is a more elegant way to do this, but this worked for me.
