Hello Chris,
Thanks for your reply. I had a look in to the timing object and now I understood a bit better how it's works but not 100%. I create a timing object (ns_timing_master, exactly the same), registered a non visual object (uo_batch_ancestor) and the event (to be called). In the example below, the ue_process is called the first time...... How this same event can be called every five seconds ?
constructor event uo_batch_ancestor - create the timing object
IF IsValid (io_timer) = TRUE THEN // YES=>Timer Instantiated?
io_timer.start( 5 ) // YES=>Start Timer
else
io_timer = CREATE uo_timing_master // NO=>Create Timer
io_timer.of_register( THIS, "ue_process" ) // Register Timer
io_timer.start( 5 ) // Start Timer
END IF
ue_process event uo_batch_ancestor
DateTime dt_endtime_today
Long ll_ret
//First we stop the timer during the process execution.
io_timer.stop()
idt_now = DateTime(Today(),Now())
dt_endtime_today = DateTime(Date(idt_now),it_endtime) //This is the datetime where the program is supposed to stop today.
it_now = Time(idt_now)
IF (Time(idt_now) > it_endtime AND Not(idt_started > dt_endtime_today)) THEN
//Don't process, but still running in background
Return 1
ELSE
IF il_interval <= 0 THEN
RETURN -1;
ELSE
//OK, let's call the job.
This.Event ue_batch()
This.of_heartbeat()
This.of_next_run( )
END IF
END IF
My timing object is not triggering the event ue_process evety 5 seconds..
of_next_run function uo_batch_ancestor
IF IsValid (io_timer) = TRUE THEN // YES=>Timer Instantiated?
io_timer.start( il_interval ) // YES=>Start Timer
else
io_timer = CREATE uo_timing_master // NO=>Create Timer
io_timer.of_register( THIS, "ue_process" ) // Register Timer
io_timer.start( il_interval ) // Start Timer
END IF
How can I keep the non visual object that I created the timing object alive waiting for the event to be triggered ? My application is closing after run the first time the ue_process. Should I call the timer event?