When system.tag.write is used to write new value to a UDT instance, the value changed gateway script never fires. However, on the next scan, the new value is contained in previousValue of the value changed script.
I would expect system.tag.write would trigger the value changed script with the new value as the currentValue.
[quote=“cmisztur2”]I forgot to mention that this is a SQL Query tag.[/quote]Well, there’s your problem. The SQL query is run at every scan and the tag change evaluated right after. So would an expression tag. Personally, I think it’s a design flaw that Ignition lets you write to such tags.
You misunderstand my point. It’s not going to work and it’s not a bug. Ignition executes tags on a schedule determined by the scan class. For Query and Expression tags, it executes the query or expression, compares the result against the tag’s current value, and generates the tag change event if they differ. They will only generate tag change events right after they execute. These tags are not supposed to be written to. If there’s any bug, it’s Ignition letting you write to these tags at all. { Other than Client tags – they don’t have scan classes. }
Why are you trying to do this? Anything you write will be replaced by the Query/Expression result at every scan.
Phil is correct, you shouldn’t/can’t write to Expression/DB tags, and we should be returning a bad quality instead of letting the write go through even though it basically has no effect.
In cases like this, you must send your data to the point where the query/expression gets the data you want. In your case, I think you should be updating the database, not writing to this tag. Then the tag will follow on the next scan.
[quote=“cmisztur2”]I want writing the tag to execute a SQL update.[/quote]Ignition can’t automagically change a Select query into an Update statement. The script that writes the tag just needs to run an update query instead.