Preparation in Reactive Web apps

Greetings,

I have read the short documentation about Data Fetching under Reactive Web Apps, however, I still don't see how to replace the preparation code that (in Traditional Web Apps) used to initialize the UI state before being displayed. More specifically I had (in Traditional Web Apps) preparation logic that uses an aggregate to extract some value from the database, and then assigns the value to the data about to be displayed. For example here is what my preparation code looked like:

Indeed I see how to insert the aggregate, but how about the assignment?

Thanks!

JP

Solution

Hi JP,

In React Apps you don't have any kind of Preparation as the traditional apps.

Instead, you can fetch the data like this:

If you need to assign or something like that, you can use the Events of the Screen. Notice that this events shouldn't have heavy logic, if not the page could get slow.


To check the best event to put your logic I would recommend to check this documentation here. Also here some best practices.

Hope it helps! Cheers.


Solution

Tiago Gomes wrote:

Hi JP,

In React Apps you don't have any kind of Preparation as the traditional apps.

Instead, you can fetch the data like this:

If you need to assign or something like that, you can use the Events of the Screen. Notice that this events shouldn't have heavy logic, if not the page could get slow.


To check the best event to put your logic I would recommend to check this documentation here. Also here some best practices.

Hope it helps! Cheers.


Thank you again, Tiago for your reply and the very relevant pointers to the documentation. Git it now. Geez, there are so many things to learn still...


Best,

JP


Hi JP,

Adding to what Tiago was saying, “Fetch data from other sources” may be what best mimics a Preparation in a traditional web app, with the only difference that you need to define output parameters explicitly. As for having only a simple assign after an aggregate, you might rather want to create a Screen Aggregate and on it’s OnAfterFetch property add an action where you can do that assign.

Cheers,

Tiago Simões 

PS: Not sure if that is the case, but if you are currently learning the platform, you have landed in the OutSystems world right in the middle of a big and important transition, and it’s natural if it feels a bit overwhelming. Reactive and Mobile training will be a much better fit than courses that are based on traditional web. And ask all the questions you have, as we are all learning with each other here.


Tiago Simões wrote:

Hi JP,

Adding to what Tiago was saying, “Fetch data from other sources” may be what best mimics a Preparation in a traditional web app, with the only difference that you need to define output parameters explicitly. As for having only a simple assign after an aggregate, you might rather want to create a Screen Aggregate and on it’s OnAfterFetch property add an action where you can do that assign.

Cheers,

Tiago Simões 

PS: Not sure if that is the case, but if you are currently learning the platform, you have landed in the OutSystems world right in the middle of a big and important transition, and it’s natural if it feels a bit overwhelming. Reactive and Mobile training will be a much better fit than courses that are based on traditional web. And ask all the questions you have, as we are all learning with each other here.



Thanks Tiago for these encouraging words. Yes I am learning the platform, as you guessed. I feel that this forum is very welcoming and informative, as well as reactive with that. Kudos to you all!


Best,

JP