249
Views
11
Comments
Solved
Aggregate tables
Question

Hi

dear I'm in need of some help

how can I make the data as shown in figure 2

figure 1 is how the data is

oml. attached


Test.oml
2021-06-02 20-50-04
Márcio Carvalho
Solution

This method on this post was something created with the same goal. In any future or even today, you want to do that using SQL. Here is an example

https://www.outsystems.com/forums/discussion/74931/sql-group-by-based-on-row-values/

This is an example of using SQL in OutSystems. 

If you are using aggregates, I also found a really good comment on something really "easy" to understand.

"

Hi Siva,

If your goal is just to show it like that in your application, you can also consider using a web block for the hobbies that get the ID as input parameter and show a list of hobbies for that ID. You can put that webblock in the cell for hobbies in your main recordlist.

Btw, if you can change the entity structure, then I would also recommend changing this to have an entity with persons, an entity with hobbies and an intermediate entity connecting those (in case of an n-to-n connection)."

I will try to implement and come back with the solution(OML).

EDIT: I MANAGED TO DO IT!

I will try to explain:

1- Create the block to list the clients


2-on the block you will need an aggregate to retrieve all the clients for the testId. 


3-Inside of the aggregate you need to do 1 thing, filter by testId the groups. To retrieve the groups for that testId

4-Then you just need to use a list, to list the groups

5-On the screen the changes you need to do is, include the block on the column of client and on changing the aggregate to group by testDR and TestId

6- Why the TestID? Because you will need to pass to the block the testId to look for the clients for that test.


Just one extra point to add. If you find some problem on the sort. Just delete on the aggregate the dynamic sort, and add again the table sort to the dynamic sort. "Since the Aggregate is grouped, this will create a Grouped Sort." Link for the citation and solution for that issue.

Kind regards,

Márcio

TestMarcio.oml
2024-06-13 07-53-34
Paulo Moreira
 
MVP

Hi Jone,

Enclose the expression on column DR in an If, and set the following condition to it:

GetTests.List.CurrentRowNumber = 0 or
GetTests.List.Current.TEST.DR <> GetTests.List[GetTests.List.CurrentRowNumber - 1].TEST.DR

Basically, what this condition does, is display the expression on the first line of the table, regardless of the page you're in, and also when the expression value is different from the previous record on the list.

This technique only works 100% if you disable the dynamic sort of the table.

Hope this helps.

Best regards,

Paulo Moreira

2021-06-02 20-50-04
Márcio Carvalho
Solution

This method on this post was something created with the same goal. In any future or even today, you want to do that using SQL. Here is an example

https://www.outsystems.com/forums/discussion/74931/sql-group-by-based-on-row-values/

This is an example of using SQL in OutSystems. 

If you are using aggregates, I also found a really good comment on something really "easy" to understand.

"

Hi Siva,

If your goal is just to show it like that in your application, you can also consider using a web block for the hobbies that get the ID as input parameter and show a list of hobbies for that ID. You can put that webblock in the cell for hobbies in your main recordlist.

Btw, if you can change the entity structure, then I would also recommend changing this to have an entity with persons, an entity with hobbies and an intermediate entity connecting those (in case of an n-to-n connection)."

I will try to implement and come back with the solution(OML).

EDIT: I MANAGED TO DO IT!

I will try to explain:

1- Create the block to list the clients


2-on the block you will need an aggregate to retrieve all the clients for the testId. 


3-Inside of the aggregate you need to do 1 thing, filter by testId the groups. To retrieve the groups for that testId

4-Then you just need to use a list, to list the groups

5-On the screen the changes you need to do is, include the block on the column of client and on changing the aggregate to group by testDR and TestId

6- Why the TestID? Because you will need to pass to the block the testId to look for the clients for that test.


Just one extra point to add. If you find some problem on the sort. Just delete on the aggregate the dynamic sort, and add again the table sort to the dynamic sort. "Since the Aggregate is grouped, this will create a Grouped Sort." Link for the citation and solution for that issue.

Kind regards,

Márcio

TestMarcio.oml
2021-03-05 15-08-01
Rogério Sousa
Staff

Hi,

Please check the attached oml. Be sure that you are not encountering in performance issues because this solution uses weblock per each row of the table.

Hope this helps

Aggregates.oml
2021-03-05 15-08-01
Rogério Sousa
Staff

I did not see the second answer from Márcio. Márcio provided a solution in the second answer. The solution is quite similar but there is not need to use a data action in the webblock. Data action is more useful if we need com mashup data and provide custom output. Both solutions should be evaluated in terms of performance. Using the aggregate would be a "cleaner" solution but both of them should work. Kudos to Márcio.

2021-06-02 20-50-04
Márcio Carvalho

Kudos to you too, you are right Rogério! :)

2022-06-06 19-53-51
Nathaly Virginia


Hello, when I needed to do something similar, I used a list of records in a Web Block

I created a web block with an input parameter, data type of the entity identifier I wanted (in your case, the DR Id). in the preparation, I put an aggregate with the entity filtered by the imput:

on my screen, I put the web block in the column I wanted and passed the table record attribute id to my input



2021-06-02 20-50-04
Márcio Carvalho

Hey there, to avoid spam,

The same solution was already given(not once, not twice, third time), and this is reactive! Even if the logic is the same, if you can do on trraditional i think there's a way to do on reactive. Check the other comments and the oml given by Jone Berti

Kind regards,

Nathaly Virginia


2022-06-06 19-53-51
Nathaly Virginia

Hi, I saw, I just wanted to share the way I did, I'm not so good with reactive yet, but maybe give some idea to the owner of the question :)

2021-06-02 20-50-04
Márcio Carvalho

Fair enough! Keep up with the good work :)

UserImage.jpg
Moacir Henrique Morais Baruffi

Hi Jones, I did it as follows...

1- I created a structure containing an RD and a list of groups

2- I created a fetch data filling the RDClient list

3- And finally, the data were presented on the screen.


Hope I helped :D

Test.oml
2021-02-18 21-45-55
Jone Berti


Good afternoon with the tips i could solve thank you so much to everyone who helped

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