In some condition the value comes form OPC which is not valid and should not to be logged, otherwise the report would be totally wrong. For example sensor wire open for AI card and AI card send overflow value to SCADA.
I try to use system.tag.editTag(tagPath=“Folder/Tag”,attributes={“HistoryEnabled”:True}) to stop history for the tag, but then I can’t reach even the valid history data which is recorded before in chart until I enable it again.
So I wander how I can temporary prevent Tag History from logging data. I want similar behavior like when the tag quality is BAD and there is no data in that duration. I try to overwrite the quality to BAD but it over written by system immediately.
what is the workaround for this kind of situation? How I can prevent logging invalid data?
Try making an expression tag that uses the forceQuality() expression function to pass the value but substitute your own quality code. That substitution can look at some other signal to decide whether to make the result good or bad. Record the expression tag instead of the original tag.