Hi, I have 3 entities like Contacts, Groups, and GroupContact (1 contact can belong to many groups and 1 group can contain many contacts).

How can display a list of Contacts and in each contact, I will display a list of Groups that the Contact belongs too. Like this

How can I achieve this? Thank you

Solution

Hi,

Are you building a traditional or Reactive web application?

You could create a block with ContactId as input that lists all groups to which the contact belongs.

Regards,

Daniel

Solution

Daniël Kuhlmann wrote:

Hi,

Are you building a traditional or Reactive web application?

You could create a block with ContactId as input that lists all groups to which the contact belongs.

Regards,

Daniel

Hi, thanks for your answer. I'm building by Traditional Web App. Don't you mean that in that block we have aggregate 1 more time to get all the Groups? 

Long Du wrote:

Hi, I have 3 entities like Contacts, Groups, and GroupContact (1 contact can belong to many groups and 1 group can contain many contacts).

How can display a list of Contacts and in each contact, I will display a list of Groups that the Contact belongs too. Like this

How can I achieve this? Thank you


Do you have a mock design to refer to? How your screen should look like !

Anyways it looks like it would just be a join between the two entities and then a group-by.  

Hi Long Du,

You could also open a clone of the Users application if you are looking to build a screen like below. 

The relationship is the same between Users and Groups. A user can belong to many groups and a group can have many users.

Tushar Panpaliya wrote:

Long Du wrote:

Hi, I have 3 entities like Contacts, Groups, and GroupContact (1 contact can belong to many groups and 1 group can contain many contacts).

How can display a list of Contacts and in each contact, I will display a list of Groups that the Contact belongs too. Like this

How can I achieve this? Thank you


Do you have a mock design to refer to? How your screen should look like !

Anyways it looks like it would just be a join between the two entities and then a group-by.  

Hi Tushar,

the design will look like this. Let me update the original post

Hi,

The easiest way (but not the most performant) way is indeed to create a block, with ContactId as input and that shows the list of groups comma separated. Alternatively, you could also do that with a function that will show its result in an expression.

The performant solution would be to generate the comma-separated list of groups as a calculated column of the Contacts aggregate. That way only 1 query to the database is executed.

Regards,

Daniel