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

Somewhat related to: Trouble getting Value Changed event to fire

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:

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

1 Like

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

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.

2 Likes

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...

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?

2 Likes

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

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

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?

See screenshot