126
Views
7
Comments
Solved
[Reactive] Aggregate in a Data Fetch or Aggregate in an Aggregate
Question

In a Reactive screen/block, if GetProduct is referenced inside DataAction, when is the DataAction going to be executed? Will DataAction wait until GetProduct is available?

The same question if GetProduct is referenced inside GetOrder.

Both are marked to run "At start".

Staff
Rank: #20
Solution

Hi Francisco,

Yes, when you have dependencies between aggregates or data actions the system automatically chains the requests.

Cheers,
Tiago Simões

Rank: #177

Hi Francisco, 

In this video, you can see how the data is loaded.


https://www.outsystems.com/learn/lesson/1947/displaying-data-on-screens 

I hope it helps.

Regards.

mvp_badge
MVP
Rank: #18

Hi Francisco,  

Each one that is configured to run at start will start async, they will start and end independent of each other.

Regards,

Daniel

mvp_badge
MVP
Rank: #5

Hello Francisco.

If you need the data from the aggregate inside your DataAction, one option is the following:

1. Change the Data Action Fetch property from At Start to On Demand.

2. Add a handler to the On After Fetch event of the Aggregate, and place a Refresh Data to the Data Action.

This way, the Data Action will be executed only when the Aggregate already fetched its data.

Another way is to place the Aggregate inside the Data Action itself and if you need its data in the screen, add an Output to it (but then, everything in the Data Action will be executed synchronously).    

Hope this helps.

Cheers.

Staff
Rank: #20
Solution

Hi Francisco,

Yes, when you have dependencies between aggregates or data actions the system automatically chains the requests.

Cheers,
Tiago Simões

mvp_badge
MVP
Rank: #5

Ah! Good to know :) lol 

mvp_badge
MVP
Rank: #71

Good question Francisco! And thanks Tiago for the answer, I did not know that too :).

If there is going to be a Professional Reactive Developer certification one day, this is a question to put in the exam. ;)

Rank: #3790

There will be a certification like that :)