Hi!
Let's say I have two aggregates with Fetch "On Start".
When I use a record from the first aggregate, in the filter of the second aggregate, will OutSystems fetch the first Aggregate in the first place?
Does OutSystems do it automatically, or do I have to fetch Agg1 On Start, set Agg2 On Demand, and refresh on After Fetch of Agg1?
Thank you!
Hello there Pedro,
Hope you're doing well.
If you have two Aggregates with Fetch "At start", they will be executed in parallel. Of course, one of them will finish its execution first, but both are executed asynchronously and at the same time. So there is no guarantee that one is going to be executed after the other.
In this case, if you have an Aggregate that fully depends on another one, so you have to ensure that the second Aggregate only runs after the first one finishes its execution (the Platform doesn't do this automatically).
So you should indeed consider your second option:
Kind regards,
Rui Barradas
Hi,
the data fetch is Assync, so, in my point of view, it's better the second option to have shure that the filter data already exist.
Hope this can help.
Best regards,
Ricardo M Pereira
Hi Pedro
Aggregates run parallelly in react app. If you want to execute Aggregates in an order,
Maybe you can create a single server action (Fetch Data from Other Sources), and move Aggregates to this action.
Hope it could help you.
Kind Regards,
Hello Tom,
That suggestion will surely work. But moving the Aggregates to a Data Action will lead to some losses in terms of performance.
Optimizations that the Platform execute automatically for Aggregates won't apply if they are inside a Data Action.