cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RemiChambard3
Advocate IV
Advocate IV

ForAll with N:N relationships

Hi,

 

I want to make a Canvas application which at the startup of the application creates a Table of data that I use as a cache to display data in the various screens.

 

To be more specific, I have two entities that are linked with a N:N relationship.

 

In order to generate that Table, I tried to the ForAll function as follow :

 

ForAll(Entity1, Collect(Entity1.Name, Entity1.Entities2))

 

However, Power Apps underlines in red the Entity1.Entities2 part specifying that it can't be used in that context.

 

Is there any way to build a Table of data that contains in the first column some attributes on the first entity and in the second column the Table of data related to the first entity. To give you an example, I want a Table that contains in the first column the name of an Author and in the second column, the list of Books related to that author assuming that there is a N:N relationship between both entities.

 

Thanks for your help !

2 REPLIES 2
EricRegnier
Super User II
Super User II

Hi @RemiChambard3,

Have you tried the following:

1) Pick desired columns from Entity2, so for example:

ForAll(Entity1, Collect(Entity1.Name, Entity1.Entities2.Column1, Entity1.Entities2.Column2))

2) If that doesn't work, have 2 tables in cache and then filter within the app? One for Entity1 and the 2nd for Entity2. For example:

ForAll(Entity1, Collect(Entity1.Name, Entity2.Id)); ForAll(Entity2, Collect(Entity2.Name,  Entity1.Id))

Hope this helps...

dpoggemann
Solution Sage
Solution Sage

Hi @RemiChambard3 ,

 

I found an answer to a prior question on doing a full outer join and displaying this in a canvas app.  The way this was done looks to be similar to what you are trying to do and there is some nice code that hopefully can help.  https://powerusers.microsoft.com/t5/Building-Power-Apps/Is-there-a-way-to-combine-2-tables-and-perfo... 

 

Hope this helps.

 

Thanks,


Drew

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (51,306)