Event meter integer works on 0 and 1 only

I have an integer I would like to measure the number times it has changed using transaction group.
It seem to behave only if bool value is assigned to the source tag. Any other value in the source tag is shows bad_stale. Entering 0 then 1 repeatedly keeps the counter going.

Events, by nature, are boolean. Your integer tag won’t work above 1. To make a boolean trigger for an event like this, you will need to more items (The incoming tag should be set to 'Direct value).

Note the order of items, as they are executed in order.

In my example ‘Event Counter’ is set up as an event meter and looks for any difference between current and previous values.

Thanks Jordan! I Not that I am stingy with my tags but I was hoping it was that easy.
I want to have a running hourly counter of a qty produced. Setup a bunch of nice transaction groups and I was dreaming of doing a simple count event (Tag) changes and reset at the end of the hour.

What would be best practices to achieve this simple goal? Ir is it really going to take 2 extra tags, and some tag change scripts? Have a ShiftHour Tag I can use to reset the hour counter but it just seems really complicated for such simple task.

Count the number of times a tag has changed write to an other tag, write to db and reset to 0 at the top of the hour.

Your screen shots should be in the manual :slight_smile:
A,.

The other two items I added are internal to the group. They’re not really extra tags, per se. But, moving on…

Getting stuff into a db is the easy part. It’s getting it back out in a way that makes sense to the user that’s hard. :wink:

I use an integer that never resets as a trigger, and insert a row to the table every time it changes. For lines that don’t have individual test data to a part, my table might have something like this for columns:

ndx, trigger, partnum, t_stamp

I store the trigger value as a sanity check to make sure I hit all of the triggers.

After this, There are a couple of things you can do query wise (YMMV, depending on which db you are using):

Hourly counts:

SELECT EXTRACT(HOUR, t_stamp), COUNT(EXTRACT(HOUR, t_stamp)) 
FROM table WHERE t_stamp >= start_time AND t_stamp < end_time
GROUP BY EXTRACT(HOUR, t_stamp)
ORDER BY EXTRACT(HOUR, t_stamp)

Part counts:

SELECT partnum, COUNT(partnum) 
FROM table WHERE t_stamp >= start_time AND t_stamp < end_time
GROUP BY EXTRACT(partnum)
ORDER BY EXTRACT(partnum)

Thanks Jordan,. this is very helpful!