cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CNT
Community Champion
Community Champion

Many-to-Many Relationship

Hello
I have a M-to-M relationship between two entities User and Location (Custom entity). I've used the Relate function to relate the records from these 2 entities and that works fine.
I my Canvas app I have 2 galleries - One for User and the other for Location.
 
In the Item Property of the Location gallery when I use the following formula, it shows the related Locations only for me (I am a Global admin).
galSelectUser.Selected.Location
But when I use the following formula (where cxe006_SystemUser_cxe006_Location is the name of the relationship), it shows the Locations for all users.
galSelectUser.Selected.'Location(cxe006_SystemUser_cxe006_Location)'
 
Any idea why it works like this. Is this a bug? 😡 or is there any valid reason for this behaviour. Any help would be greatly appreciated.
 
Thanks
 
4 REPLIES 4
Drrickryp
Super User II
Super User II

Hi @CNT 

My reading of https://powerapps.microsoft.com/en-us/blog/relate-records-in-many-to-many-relationships/  indicates that the First() function has to be used in displaying the data in a Many to Many relationship. 

CNT
Community Champion
Community Champion

Hi @Drrickryp FIrst() is needed only if u need the first related record. I found that you have to refer to the relationship name and not the entity name. This seems to be a mistake in the documentation.

@CNT 

Good to know.  It sounds like you found the solution to your question?  If you did, could you post how you were able to do it in your app?  I still feel more comfortable creating my own junction tables rather than using the built in relationships. 

CNT
Community Champion
Community Champion

HI @Drrickryp 

Yea, but the documentation is so misleading and needs fixing to save time and effort for others.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,719)