Conditional Group Trigger

I have a group where the trigger is a value change of a string. The test equipment I am monitoring will write an empty string if there is an invalid test. The group is seeing this change to an empty string and running the group.

Is there a way to trigger on a change AND verify the length is > 0?
Or
Have the first action item check for length and abort if the length is 0?

Thanks

In order to accomplish this you need to add three new action items to your group.

The first action item is an expression with the following settings:

Item Name: LastString
Item Mode: Expression
Command:GetVariable("LastString", "")
Result Datatype: String
Ignore group trigger setting checked (so it runs at the rate of the group)

This action item will get the string’s last known value. The next action item is also an expression with the following settings:

Item Name: StringChanged
Item Mode: Expression
Command:if({LastString} != {OPCStringTag} && Len({OPCStringTag}) > 0, 1, 0)
Result Datatype: Boolean
Ignore group trigger setting checked (so it runs at the rate of the group)

This action item checks the last known string against the new OPC string value to see if they are different, and if so it makes sure the length of the new string is greater than 0. If both conditions are true the action item returns true otherwise it returns false.

The last action item is also an expression with the following settings:

Item Name: SetLastString
Item Mode: Expression
Command:StoreVariable("LastString", {OPCStringTag})
Result Datatype: Unspecified
Ignore group trigger setting checked (so it runs at the rate of the group)

This action item will simply store the new OPC string value into the variable LastString.

The last thing you need to do is set the trigger of the group to the StringChanged action item. Make sure the ‘Only execute group once when triggers is active’ is unchecked and the trigger condition is set to ‘is > 0’. This way anytime the value changes and the length is greater than 0 the group will run. Let us know if you any questions.