Yeah, you might be able to get what you want with the DISTINCT keyword.
I never really answered your original question because it would be fairly difficult to set up the correct trigger to prevent this, and I wanted to make sure we discussed it a bit before we got into that. However, I’ll briefly outline some ideas of what you could do…
I think that in simple terms all you really want to do is have a value that is only updated while the quality is good. Thus, you need to make the opc value an input into an action item (or multiple) which does this, and then in turn use that as the trigger.
Some useful things that might help:
-The Store/GetVariable functions
-The fact that you can get an item’s quality by appending “.DataIntegrity” to its name in a reference, ie {MyOPCItem.DataIntegrity}
There are probably a number of ways to do this, but I would do the following:
Action Item 1:
Expression-
if(ToInt({TriggerItem.DataIntegrity})=192, StoreVariable("triggervalue",{TriggerItem}), null)
Ignore group trigger settings: Checked
Action Item 2:
Expression-
GetVariable("triggervalue",0)
Ignore group trigger settings: Checked
Group Trigger: Action item #2.
So, the first one stores the variable if the quality is good. The second part of the IF (",null") is necessary because the IF function requires two parts. The null just doesn’t do anything.
The second just retrieves the stored value. If the quality is good, it will match the the first value. If not, it will be the last good value. Both items are set to run always so they’ll be executed irregardless of the trigger. Use the second item as the group trigger, with the “only execute once while trigger is active” option.
Hope this helps, let me know if I’ve missed anything.