I have a standard group here where I am trying to trigger using a SQL group tag to perform an update on my database.
I am using the hour meter and trying to log runtimes per shift.
So I am updating the row and at shift change, I am adding a NULL row using SQL server.
This is so it will update the next row and keep my old shift information in the same table.
However, I did get this to work numerous way… Although none of these settings seem to work 100% of the time.
I have my shift change as a button with the following event script:
system.db.runUpdateQuery(“INSERT INTO motorrun (t_stamp) VALUES (CURRENT_TIMESTAMP)” )
system.db.runUpdateQuery(“INSERT INTO photo (t_stamp) VALUES (CURRENT_TIMESTAMP)” )
ShiftReset is a bool SQL tag with INt2 group data type.
my execution scheduling is set to timer ‘1 second’
My items are set to hour meter, retentive, and reset on ShiftReset = 1
my trigger is set to only execute once while trigger is active
reset trigger after exectution
trigger conditions are is >0
If I change these settings to the handshake settings, I get the same results.
The problem seems to be a timing issue between my execution scheduling and how fast I can change my trigger and reset it.
Dropping my execution time down to 1 milisecond seemed to help my resets, but crippled my accumulation.
It seems like there is something strange here, this seems very difficult to set up.
It also seems like I want to be able to have conditions for when to take a certain table action.
For instance, I’d like to insert a new row or block on my reset, but on my standard execution of the group where my meters are running I want it to only update the last row or block in the table.