Implement asynchronous data fetching using aggregates

Hi, I am follwing the steps in the training for creating a screen where I can fetch details from a list: 

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/Implement_asynchronous_data_fetching_using_Aggregates

Steps to follow:

  1. Add the first Aggregate that loads the items list and set the Fetch property to At start. Name it AggMaster.
  2. Add the second Aggregate that loads the details and set the Fetch property to At demand. Name it AggDetails.
  3. Create a local variable that holds the current record, for example SelectionId and use it in the filter of AggDetails to fetch a single record.
  4. Add a widget and populate it with the items from AggMaster.
  5. Build another UI section and populate it with the values of the current AggDetails record.
  6. Create an Action that is triggered when the users click an item from the AggMaster. The Action should have an input that identifies the record. For example, the Action could be ListItemOnClick and the input SelectedItemId.
  7. Design the Action so it sets a new value of the SelectionId local variable and then refreshes AggDetails.


I get stuck here. Creating the aggregates (1st, 2nd step) are done. 

Step 3: Where do I create this local variable, and exact what do I have to do to make it hold the current record, and what do I have to do to use it in the filter of Aggdetails to fetch a single record?

Step 4 and further on are also hard to follow. As all previous trainings are easy understandible to me, I hope someone can get me on the way again....

Hi Cohen,

Welcome to OutSystems. You can create a local variable by right-clicking the screen and selecting that option from the context menu. 

Cheers,

Tiago Simões

PS: because the platform is visual, the training videos can often be easier to follow https://www.outsystems.com/learn/paths/18/becoming-a-reactive-web-developer/

Step 7 should be where you set the value, using an assign and a refresh data. 

Thanks for your answer Tiago,

Still not able to fulfil the exercise. Let me explain my actions step by step….

I uploaded an entity from Excel (sampledata).

After that, I dragged a screen, selected Empty, Named it AggMaster, dragged a list in the main content of the screen and via the datatab, inserted two entity attributes (Orderdate and Item). GetBlad1s: Fetch was set to At start by default.

Via the interfacetab/Mainflow I inserted a new screen, empty again, and named it AggDetails. Dragged a form in the maincontent area, and filled it via the datatab with all entity-attributes. GetBlad1ById: I switched Fetch to “Only at demand”.

Q1: For both aggregates: is this the right thing to do? I created a screen, and with that, automatically the aggregate was created. Or should I create an aggregate without the screen? If so, how?

By default (via OutSystems), a local variable was created, called Blad1Id. However, step 3 mentions that I should create a local variable that holds the current record, and that I should use it in the filter of AggDetails to fetch a single record.

Q2: So, is step 3 automatically created by OutSystems, or should I do something?

After this I am supposed to add a widget and populate it with the items.  The final question: Exactly what am I supposed to do here?

Following my approach I do have 2 screens, both equipped with an aggregate. No idea what to do for step 4.

For me as a beginner this is the part where I got stuck.

Hopefully you or a fellow developer can help me finish this trainingpart (or at least get me to finish step 4:-). However, I’ll start the youtube course Developing Outsystems Web Application.

Solution

Hi Cohen,

I believe that exercise is to put everything on the same screen. We probablyneed to review the text to make it more explicit. In any case I strongly suggest you to follow these:

https://www.outsystems.com/learn/paths/18/becoming-a-reactive-web-developer/

Cheers,

Tiago Simões 

Solution

Hi Cohen,

I agree with Tiago, Please check the tutorial and you will get the solution. Specifically, you need to read this tow material among all. Below are the links,

https://www.outsystems.com/learn/courses/126/aggregates-101/?LearningPathId=18

https://www.outsystems.com/learn/courses/127/building-screens-with-data/?LearningPathId=18

Please check and let us know if you still get problem with it. I hope your issues will be solved.

Waiting for your feedback,

Thank you,

Sudip

Hi Sudip and Tiago,

tnx a lot, I am currently doing the https://www.outsystems.com/learn/paths/18/becoming-a-reactive-web-developer/ course, and will give a go to the 2 courses as advised by Supid afterwards.


Best..., Coen




Hello Coen,

We've revamped that document. Now it reads more like a tutorial approachable to people who are just getting familiar with OutSystems, rather than a reference for experienced developers. The document is much longer and provides better guidance, through the three section on how to create master-detail pattern:

  1. Creating "master" list which loads immediately
  2. Crating "details" which load on request (asynchronously)
  3. Wiring the two parts with logic (this cool part showcases how Reactive App updates UI when the values update)

And yes, Tiago is correct. The feature is updated, so you no longer need Local Variables, as in the first version of the tutorial.

Load all items in master detail

We hope this helps!