hasChanged Expression

Hi,
Can you describe the operation of the haschanged status/event?
I can’t find anything in the manual.

I’m thinking of using an expression against 2 tags to trigger a transaction group but will need to monitor the haschanged for both tags.
The tags will change at different times, so I’m curious as to when the haschanged status for a tag is reset.

The trigger will be something like: (Phase > 210) && hasChanged(Phase) && hasChanged(BatchNumber)

The Phase can change to any number.
I need to be sure that the BatchNumber has also changed before I trigger the group.

Thanks,
Tim

Hi,

Yes, this should be documented more carefully (at all? :-/ ) because it is a little tricky. Basically, the “hasChanged” function stores the value passed to it each call, and then compares the subsequent call to that. This makes it unsuitable for what you’ve described, as one call to “hasChanged(Phase)” could return true, and then the next time, it would return false, as you go to check batch number.

I can’t come up with a great & concise way to basically wait for multiple things to change over time, and then trigger on it. I can, however, come up with a fairly complex way (requires 5 extra tags in the group), as demonstrated by the attached group. Import it by right clicking on the Transaction Groups node and select Import>From XML.

If you can simplify your trigger requirements, that could help. Otherwise, see if the example here makes sense, and I can explain it more if necessary. It basically creates latches for the two change conditions, and then resets them through a success handshake to a memory tag in the group, which will happen when the group actually runs.

Regards,
ComplexTriggerGroup.xml (12.2 KB)

Also, I should point out (though it might be obvious): for the example, I made Phase and BatchNumber memory items in the group… in your group they would be OPC items.

Regards,

Thanks Colby,
I’ll look at this and let you know.
Tim