# system.tag.writeBlocking sometimes doesn't update the Timestamp? with BasicQualifiedValue

**URL:** <https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [August 1, 2023, 6:54pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249 "2023-08-01T18:54:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elizabeth\_Myakisheva](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@Elizabeth\_Myakisheva](https://forum.inductiveautomation.com/u/Elizabeth_Myakisheva)\
**Post date:** [August 1, 2023, 6:54pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/1 "2023-08-01T18:54:07Z")

</div>

So I have a (well actually I have dozens, but I've narrowed down the problem to just one) Integer memory tag (and some reference and expression tags pointing at it), and its value stays constant most of the time. I have a script running every 8 seconds to ask a server on the network for the latest value, and I use a block of code like this to update the tag:

```py
TESTING_OFFSET = -1000

from com.inductiveautomation.ignition.common.model.values import BasicQualifiedValue

# Create a BasicQualifiedValue with value 100
bqv = BasicQualifiedValue(100)
bqv.timestamp = system.date.addYears(system.date.now(), TESTING_OFFSET )

# Write the BasicQualifiedValue to a Tag path
system.tag.writeBlocking(["[ThermotronDev]ThermatronDev/integer"], [bqv])

```

I use the timestamp in another script to confirm that the other script ran successfully within the past 8 seconds.

Here's a test I wrote to confirm that Ignition isn't saving my timestamp:

```py
TESTING_OFFSET = -1000

from com.inductiveautomation.ignition.common.model.values import BasicQualifiedValue

# Create a BasicQualifiedValue with value 100
bqv = BasicQualifiedValue(100)
bqv.timestamp = system.date.addYears(system.date.now(), TESTING_OFFSET )
print("input timestamp: {}".format(bqv.timestamp))

# Write the BasicQualifiedValue to a Tag path
system.tag.writeBlocking(["[ThermotronDev]ThermatronDev/integer"], [bqv])

#confirm that the bqv's timestamp was saved in the Ignition Tag
tagsTimestamp = system.tag.readBlocking(["[ThermotronDev]ThermatronDev/integer"])[0].timestamp
print("output timestamp: {}".format(tagsTimestamp))
assert tagsTimestamp == bqv.timestamp, "the timestamp wasn't saved! :("
#if assertion succeeded:
print("the timestamp was saved! :)")

```

The assertion only succeeds if the value of the BasicQualifiedValue is changed from the number it was last time I ran this test script. If the value of the BasicQualifiedValue is the same, or if just a value is used instead of a BasicQualifiedValue (like True or False, and the value is the same as last time), then the assertion fails.

Should I try to work around this? e.g. by setting all of my tags' values to null for a few milliseconds before writing new values? Or maybe I'm using the timestamps feature wrong?

---

<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:** [August 1, 2023, 6:56pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/2 "2023-08-01T18:56:29Z")

</div>

Timestamp-only changes won't propagate. You have to change the value.

---

<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:** [August 1, 2023, 7:39pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/3 "2023-08-01T19:39:00Z")

</div>

They should if the deadband mode is off though.

 ![Screenshot_20230802_051008_Chrome](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4dc9588e9a1243f5cedca235fb3594b160e0454f.jpeg)

[https://docs.inductiveautomation.com/display/DOC81/Tag+Properties](https://docs.inductiveautomation.com/display/DOC81/Tag+Properties)

---

<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:** [August 1, 2023, 7:41pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/4 "2023-08-01T19:41:00Z")

</div>

The other thing that might be at play here is the "Allow back-fill data" advanced setting on Tag Providers.

---

<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:** [August 1, 2023, 7:42pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/5 "2023-08-01T19:42:35Z")

</div>

That description of "Off" was written by somebody who was confused.

Deadband off means any value change, i.e. previous value != current value, with no regard for how small the change was in either absolute terms or as a percentage of engineering range.

---

<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:** [August 1, 2023, 7:50pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/6 "2023-08-01T19:50:58Z")

</div>

I'm sure I've used this before though to change just timestamps. When you say current value!= previous value, are you meaning qualified values? Or the value properties of these?

---

<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:** [August 1, 2023, 7:54pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/7 "2023-08-01T19:54:05Z")

</div>

The deadband actors only care about the quality and value component, they aren't looking at timestamp.

---

<div class="post-metadata">

**Author:** ![Elizabeth\_Myakisheva](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@Elizabeth\_Myakisheva](https://forum.inductiveautomation.com/u/Elizabeth_Myakisheva)\
**Post date:** [August 1, 2023, 7:58pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/8 "2023-08-01T19:58:01Z")

</div>

> [@Kevin.Herron](#):
>
> The other thing that might be at play here is the "Allow back-fill data" advanced setting on Tag Providers.

I don't think it's applicable because tag history is disabled for this tag provider?

---

<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:** [August 1, 2023, 8:02pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/9 "2023-08-01T20:02:00Z")

</div>

Only mentioned it because you were creating timestamps in the past, and I think there are some quirks if you try update a tag value with a timestamp prior to the current one.

---

<div class="post-metadata">

**Author:** ![Elizabeth\_Myakisheva](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@Elizabeth\_Myakisheva](https://forum.inductiveautomation.com/u/Elizabeth_Myakisheva)\
**Post date:** [August 1, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/10 "2023-08-01T20:03:18Z")

</div>

Setting the **Deadband Mode** to **Off** seems to fix the issue my test code, thanks! I will try to implement that in my main project.

---

<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:** [August 1, 2023, 8:06pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/11 "2023-08-01T20:06:24Z")

</div>

I'm now wondering if all the stuff I'm saying is only applicable to OPC tags...

---

<div class="post-metadata">

**Author:** ![Elizabeth\_Myakisheva](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@Elizabeth\_Myakisheva](https://forum.inductiveautomation.com/u/Elizabeth_Myakisheva)\
**Post date:** [August 1, 2023, 8:06pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/12 "2023-08-01T20:06:48Z")

</div>

> Allow Back-fill Data  
> If enabled, data will be allowed to arrive out of order from the source.  
> Data from the past will be stored to history, but will not be used for alarms, scripts, or subscriptions.  
> If false (default behavior), each value will be processed fully as it arrives.  
> (default: false)

It seems like my desired value for this setting is the same as default, false.

---

<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:** [August 1, 2023, 8:07pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/13 "2023-08-01T20:07:43Z")

</div>

Yeah, I think you're right, and @nminchin too. Carry on.

---

<div class="post-metadata">

**Author:** ![james.vosler](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@james.vosler](https://forum.inductiveautomation.com/u/james.vosler)\
**Post date:** [December 14, 2023, 9:29pm UTC](https://forum.inductiveautomation.com/t/system-tag-writeblocking-sometimes-doesnt-update-the-timestamp-with-basicqualifiedvalue/77249/14 "2023-12-14T21:29:00Z")

</div>

> I'm now wondering if all the stuff I'm saying is only applicable to OPC tags...

FWIW - It appears that writing to OPC tags will not take the qv's timestamp regardless of whether the value changes or whether the deadband is off.

As for the deadband, I had mixed experience with memory tags. Some worked only when the deadband was off (8.1.24), others also worked with absolute set (8.1.33). Neither gateway I tested with allowed backfill.
