11
Views
8
Comments
Set up TimerEvent for all data in the database
Question

Hi all,

I'm currently working on a Task Management. When the deadline of a task has passed, its status should turn into "Deadline passed". The Task Manager should check every night, if the deadline has passed or not.

I built a logic for that. My problem is, to implement the logic into a timer. I select the logic in the field "Action" and want to select all tasks of the database in the field "Tasks". But I'm stuck doing it, because it gives me error messages all the time.

Here you can see my logic "Change_Status" and in the right column the fields of the timer.

Thanks a lot for your help and have a great day.

Rank: #1017

Hi Raphael,


You can create other action between the timer and the change status action. 


This new action should not have any input parameters. There you can query the takss, create a foreach and for each task call the change status action.


King regards,

Plácido

Champion
Rank: #99

Hi,


You can make an SQL advanced were you select all tasks with the deadline passed (need to see if you need more filters because of all conditions, p.e. the previous status) and updated them all for the new status. With this you perform a bulk operation that is much more eficient that the foreach iteration. 

With that you don't need to make more code in your action that the timer is running and don't need input parameters.


Hope this can help!


Best regards,

Ricardo M Pereira

Hi Raphael,

Here is my suggestion.


1 - Create task and status tables (you should already have)

2 - Create a "ChangeStatusDeadlinePassed" server action. In this server action you will only get delayed tasks with a status other than "deadline" and update status for "past deadline"


3 - Create a stopwatch once a day


Raphael,


Could you send me the code?

Attach the oml file.

Please, check the the action change_status2. 


You do not need pass a task into input parameter because this method works for all tasks. 


TaskManagerv3.oml