# Change timestamp on memory tag write even when value/quality doesn't change

**URL:** <https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026>\
**Category:** Ignition\
**Created:** [May 22, 2023, 3:11pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026 "2023-05-22T15:11:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [May 22, 2023, 3:11pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/1 "2023-05-22T15:11:08Z")

</div>

Somewhat related to: [Trouble getting Value Changed event to fire](https://forum.inductiveautomation.com/t/write-to-tag-and-set-timestamp/60100)

I would like a change script of some kind to fire anytime I write a value to a memory tag, even if I write the value to the tag that it already has.

When I run:

```auto
from com.inductiveautomation.ignition.common.model.values import BasicQualifiedValue as qval, QualityCode as qc
currentTagValue = system.tag.readBlocking(["[default]Tests/QualityChangeCheck"])[0].value
value = qval(currentTagValue, qc.Good, system.date.now())
system.tag.writeBlocking(["[default]Tests/QualityChangeCheck"], [value])

```

The timestamp doesn't change, no scripts run, etc. I understand why that might be, but is there any way for me to work around this?

I could read the tag, change it to something different, then change it back, but that could have plenty of side effects of its own.

Any other ideas? or am I missing something?

Thanks

---

<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:** [May 22, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/2 "2023-05-22T15:19:03Z")

</div>

I vaguely recall a bug report about this. Something similar was in the nightly change log not that long ago.

---

<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:** [May 22, 2023, 10:48pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/3 "2023-05-22T22:48:00Z")

</div>

> [@ken.maze](#):
>
> even if I write the value to the tag that it already has.

You'll need to set your tag deadband mode to Off so that value changes without change in the actual value ... confusing ... still make it into the tag value. Otherwise, the deadband will see no change outside of it's range and discard the new value.

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [May 23, 2023, 3:27pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/4 "2023-05-23T15:27:55Z")

</div>

> [@ken.maze](#):
>
> ```python
> from com.inductiveautomation.ignition.common.model.values import BasicQualifiedValue as qval, QualityCode as qc
> currentTagValue = system.tag.readBlocking(["[default]Tests/QualityChangeCheck"])[0].value
> value = qval(currentTagValue, qc.Good, system.date.now())
> system.tag.writeBlocking(["[default]Tests/QualityChangeCheck"], [value])
> 
> ```

That makes sense, and so I changed it to deadband off, and then the timestamp changed, even when I wrote the same value to the tag. Even when I just wrote the value, not the full qualified value. Seemed like a good sign.

_However_, neither the Value Changed nor Quality Changed scripts fired.

So halfway there kinda...

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 23, 2023, 3:42pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/5 "2023-05-23T15:42:25Z")

</div>

> [@ken.maze](#):
>
> _However_, neither the Value Changed nor Quality Changed scripts fired.
> 
> So halfway there kinda...

They won't, by design.

Why don't you just move the logic in those scripts to a function in the script library and then call that function?

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [May 23, 2023, 4:42pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/6 "2023-05-23T16:42:33Z")

</div>

It is something I want to run whenever this tag is written to, even if it doesn't change the tag value. I thought changing the timestamp would fire the value change, since the timestamp is one of the values in the qualified value, but it looks like I misread that.

So yes, I will call a function in the project script to run the logic and write to the tag.

Thanks

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [May 25, 2023, 2:20pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/7 "2023-05-25T14:20:49Z")

</div>

The other workaround is to put an expression tag referring to the timestamp of the tag I am wanting to fire on timestamp changes. When that fires I know the timestamp changed. I even combined it with the value of the tag I am monitoring, so I can get previousValue/currentValues of that tag

---

<div class="post-metadata">

**Author:** ![19tb21](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@19tb21](https://forum.inductiveautomation.com/u/19tb21)\
**Post date:** [January 8, 2024, 4:00pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/8 "2024-01-08T16:00:09Z")

</div>

> You'll need to set your tag deadband mode to Off

excuse my ignorance, but how does one do this, or do you mean on a historical tag?

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [February 5, 2024, 1:47pm UTC](https://forum.inductiveautomation.com/t/change-timestamp-on-memory-tag-write-even-when-value-quality-doesnt-change/74026/9 "2024-02-05T13:47:00Z")

</div>

See screenshot

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