Trigger "On change Hour" doesn't work

Hello
I have problem with Trigger “On Change Hour”, it doesn’t work properly.
My trigger is written as ESL server event. I need to create some reports during night, but my reporting process was never started. I have checked if on change value triggering in D2000 is possible and we use many other triggers in our application, but I don’t know where is a problem for that case. Does anyone have similar experience?
.
Here is an example from my code.

//BEGIN SERVER EVENT//
;--------------------------------------------------------------------

PROCEDURE Trigger(REAL _value, ALIAS _obj, INT _row, INT _col)
BOOL _bOk

IF %Hour(SysTime) = 22 THEN
CALL [E.ReportGenerator] GenerateReports(_bOk) ON SELF.EVH
ENDIF

END Trigger

;--------------------------------------------------------------------

BEGIN
ON CHANGE Hour GOTO Trigger
END

;--------------------------------------------------------------------
//END SERVER EVENT//

I’m using version D2000 V10 R39.
Thanks

Two things come in mind. First, check monitoring database for possible errors from this event as well as from E.ReportGenerator (perhaps it ended with unhandled exception inside your GenerateReports function).

Second thing - a more probable one is this.

Your procedure Trigger is hooked on change of Hour object. Therefore, inside it, you should test if _value = 22 (btw, _value can be declared as INT). Do not reference another system object SysTime, as its change may not have arrived into Event yet. So, what is probably happening is this: new value of Hour (22) came to Event. Value of SysTime is 21:59:59.00x (some miliseconds). The trigger is run, but %Hour(SysTime) is 21, so the report is not generated. Next hour, if the execution of trigger is a bit delayed and SysTime managed to be updated to 23:00:00, then %Hour(SysTime)=23 and report is not generated again.
A possible workaround would be inserting a DELAY before testing Hour (e.g. 1-2 seconds should be enough … depending on system load) but a solution that deterministically works, no matter what load, is working with _value (IF _value = 22 THEN …)

Two things come in mind. First, check monitoring database for possible errors from this event as well as from E.ReportGenerator (perhaps it ended with unhandled exception inside your GenerateReports function).

Second thing - a more probable one is this.

Your procedure Trigger is hooked on change of Hour object. Therefore, inside it, you should test if _value = 22 (btw, _value can be declared as INT). Do not reference another system object SysTime, as its change may not have arrived into Event yet. So, what is probably happening is this: new value of Hour (22) came to Event. Value of SysTime is 21:59:59.00x (some miliseconds). The trigger is run, but %Hour(SysTime) is 21, so the report is not generated. Next hour, if the execution of trigger is a bit delayed and SysTime managed to be updated to 23:00:00, then %Hour(SysTime)=23 and report is not generated again.
A possible workaround would be inserting a DELAY before testing Hour (e.g. 1-2 seconds should be enough … depending on system load) but a solution that deterministically works, no matter what load, is working with _value (IF _value = 22 THEN …)