361
Views
2
Comments
Batch processing
Question

I have a timer and this timer will populate some fields of some movies of the Movie table that are empty “”.

So in the timer action, I have a query “GetMovies” with a filter to returns all the movies that have some fields empty. 

Then I have a foreach “GetMovies.List”, in the foreach I have a server action “GetMovieData” that returns a Movie Record. Finally, I have an UpdateMovie server action to update that returned Movie Record and then a commit server action and the flow returns to the “GetMovies.List”.

I'm in doubt about how to improve this logic, for example, if there are thousands of movies in the database this logic don't seem very secure. To improve this I added a timeout control after commit I have an if (DiffMinutes(CurrDateTime(), StartDate) >= 10) then is started a new timer and the flow goes to the foreach.

 

My doubt now is how to get some records for example process only 100 records each time instead of getting all the records (batch processing) and ensure that record is not got again. Do you know what is a good approach for this scenario? 

UserImage.jpg
Naren

Hello John,

Create a calculated boolean attribute and set it's value as true when it gets updated.
Filter the aggreagte only where Boolean value = false
Now you can set the Max records property of the aggregate/SQL to 100

2024-09-14 05-42-00
Ozan Can Çalı
Champion

Hi John,

The video of the following OutSystems masterclass lesson actually explains it neatly. Just jump to 2:25:00 to see the part about Best Practices for Building Timers:

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.