Best Practices - Timer - Example of shown code

Hi Everyone, 

I am trying to implement best practices in outsystems in specific for timers.  

What i understood was we should define a new timeout in our logic and awake the same timer if it is close to timeout and we could not iterate all the records yet.

I am looking for code examples, function i can use, the right place where i need to add the correct code, specifing for two important points to apply it :

1) The first assign we should define in a timer to set the new timeout, i built it like that :

I am not sure it is correct so i am trying to find others approches or find the way to put it correct.


2) The second point is where i should put the wake timer and whenever i awke it , 

Does it keep iterating for the next record, indeed?

Because by debbuger  i just can see always the same record 

The way i have it is like that:


A great answer will be and example as i put my implementation 

- for the first assign ,(The funtion i should use )

- the two ifs " Timeout passed? " and " Es Ultimo(Is The last record?)" , (the function i should use)

- and if the branches are well connected, 

- as well as the place where i but the awake timer

- and still if the awake timer , in my case "Wake BatchMigracionProyectoAg" is, in fact, the current action we are iterating, in my case is BatchMigracionProyectoAG and in process tab i am using that action also doing my "Wake BatchMigracionProyectoAg"

So wanting to evalute the approach i am looking forward for improving, so exposing to get some help

Thanks

Best regards.

Hi,

You can check a good example on the Master Class on Best Practices and Timers at around 2h:22m:48s

https://www.outsystems.com/learn/lesson/1133/master-class-on-best-practices-and-timers

Best Regards.

Hello Sofia.

The master class example is almost the way I usually do timers. Regarding your questions:


1) Because you can't be sure of when the timer will start, the limit should be set in minutes from now, not a specific date. "Stop 10 minutes from now" or something like that.  AddMinutes(CurrDateTime(),10)

2) your timer always does the Excel step. That one isn't needed (it is only extra load and restarts the count).


Why don't you:

Create a timer to read Excel into a table.

Create a timer to process each row from the table (with all the cares).

Timer1 calls Timer2 and on the second you follow all the best practices.


Best practices are simple:

Control your timer (make it stop when you want)

Control your data (be sure of what was processed or not)


Here goes a pseudo-code example.