Skip to main content
ashwini.nemade
Employee
Sep 9, 2024 12:03 PM UTC
Question

Starting a process at particular time which is stored in DB

I have a requirement where the processes are scheduled within a range of 12 hours, let's say 3 PM to 3 AM, with a time gap of 1 hour. So my batch process should start at 3 PM but after first instance it should be triggered after every 1 hour till 3 AM. Is there any way we can achieve this using Timer event?

Also, I am recording the scheduled date and time in the database. Is it possible to directly get that time and start the process with it?

Any ideas how we can achieve this?

4 replies

davidj137213
Brainy
Sep 9, 2024 12:28 PM UTC

You can set several timers in your process with no problem...

About having the details in the DDBB, the only way to achieve this is with a timer condition where you execute a ER that checks the time in DDBB, and executes the timer if the condition is met.

ashwini.nemade
Employee
Sep 9, 2024 12:40 PM UTC

And just to confirm, we need to check the time in DB with the system time using now() function, correct?

davidj137213
Brainy
Sep 9, 2024 1:05 PM UTC

It depends on your implementation... but yes... now() function is an option...

kumara0180
Participating Frequently
Sep 9, 2024 12:58 PM UTC

I would use the following config on timer to fire it every hour

And to stop the process getting triggered outside the 12 hour window I would add an expression which would return false if current time is outside my window 

contains(
  {
    "03:00 PM",
    "04:00 PM",
    "....",
    "03:00 AM"
  },
  text(now(), "HH:mm aa")
)