25
Views
9
Comments
Solved
aggregate when have many to many relationship

I have  screen to display all exhibitions with (Name, Start Date, End Date, participate company, Type) details in a table

If I make it one aggregate I got duplicated records

so I make 2 blocks and drag them to the table to solve this issue

Is there another way to get same result?

Thanks in advance

Demo.oml
Solution


Something like this, a data action that returns the list of Exhibitions with the companies and types in the example below

Demo_v1.oml
Champion

Hello

Can one exhibition have multiple Types?


yes and multiple companies as well


I don't know if this is what you want, but if an Exhibition can have several types then it will bring several records for the same Exhibition if in fact it has several types. What you can do is fetch the type separately and show it as a comma-separated string. If you don't intend to display multiple types, then the foreign key is in the wrong table. the type must be in the displayed table

could u please explain more what do u mean by (fetch the type separately and show it as a comma-separated string )

Solution


Something like this, a data action that returns the list of Exhibitions with the companies and types in the example below

Demo_v1.oml

Thank you so much

but in this way how to filter them by dropdown tag

I want to filter the table result by companies selected from the dropdown tag

you can filter on the aggregate within the data action or even on the functions you are calling. Today I can no longer provide you with another example.

you may also check my Forge component https://www.outsystems.com/forge/component-overview/15145/pattern-sql-patterns that shows how to turn an aggreagte result into a nested structure.

Stefan

Champion

Hi,

We can use SQL statement instead of aggregate here. In SQL using STUFF you can get multiple companies and events name separated by comma in a single record. For more reference https://stackoverflow.com/questions/21760969/multiple-rows-to-one-comma-separated-value-in-sql-server

regards



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