cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GarryPope
Impactful Individual
Impactful Individual

Canvas app with CDS Many-to-Many relationship in a Gallery

Hello Power Apps Community,

I would like some help please. 

I've created two CDS entities: "Level" and "Measure". It's a "Many-to-Many" relationship.

I have a simple canvas app. 

On screen 1 is a gallery of all the records for "Levels". I have a "Next Arrow" icon against every "Level" record. 

When I select a specific "Level" record, it navigates to screen 2.

On screen 2 I wish to have a gallery of all the "Measure" records for the selected "Level" record.

 

So, my question is how can I show all the "Measure" records for the selected "Level" record?

 

I can't find out how to do this and think it's due to the Many-to-Many relationship. At a One-to-Many relationship I've been able to achieve this by using a filter with different entities.

Any help would be greatly appreciated.

 

Garry

1 ACCEPTED SOLUTION

Accepted Solutions
GarryPope
Impactful Individual
Impactful Individual

Hello @EricRegnier,

I spoke with Microsoft, and actually this is really easy to do. Like always, I was making it far too complicated! They pointed me to this Microsoft blog post. It works perfect.

Thanks for your help.

Garry

PS @jlindstrom thanks for the tip!

View solution in original post

7 REPLIES 7
EricRegnier
Super User
Super User

Hi @GarryPope

I assume you're using the out-of-the-box CDS many to many relationship type? Haven't tried it myself but in your expression, can your try by navigating with the relationship name or relationship entity name? For ex:

Gallery1.Selected.<relationship name>

2020-08-04_21-39-28.png

GarryPope
Impactful Individual
Impactful Individual

Hello @EricRegnier,

Thanks so much for the reply. I hope all is well.

You are correct, I'm using the out-of-the-box relationships for CDS. 

I tried your suggestion, but wasn't able to get it working, it might be my lack of understanding of canvas app functions/formulas etc. So I've raised a ticket to Microsoft. When I hear back from them, I'll post it here. 

A question relating to this, do you know of anyone who has a great blog/YouTube channel that focuses on building canvas apps with CDS? If so, if you could provide me with the details that would be great. Now that Data Flex is coming I need to focus on canvas apps more. Haha. 

 

Like always, thanks for your help,

Garry 

Shane Young has several cds canvas app videos

https://youtu.be/49O1UW-tkyo

GarryPope
Impactful Individual
Impactful Individual

Hello @EricRegnier,

I spoke with Microsoft, and actually this is really easy to do. Like always, I was making it far too complicated! They pointed me to this Microsoft blog post. It works perfect.

Thanks for your help.

Garry

PS @jlindstrom thanks for the tip!

Hi GarryPope, What kind of formula did you use? The link was quite vast and I wasn't able to find which one you used.

GarryPope
Impactful Individual
Impactful Individual

Hello @shavora,

Thanks for the message. It's over a year since I last looked at this, so had to remind myself what I was doing. And I've deleted the app I was creating. From the Microsoft post look at where it begins "Many-to-Many Relationships".

 

I quickly built a basic app and tried it out, and I was able to click on a record in my "Level" table and only see the records associated to it from my "Measures" table in another gallery. See below. 

 

I created a screen with a gallery and pointed at my Level table.
It shows all Level records in Dataverse.  

GarryPope_0-1637008241346.png

 

For the chevron icon at the end of each record I set the OnSelect property as 
Select(Parent); Navigate('Screen Measure')

GarryPope_1-1637008399263.png

 

When I click the chevron icon I want to be taken to a second screen that shows all the "Measure" records associated with the selected "Level" record.

 

To do this I created a second screen with a gallery.

In the gallery's "Items" property I set it to: 
'Gallery Level'.Selected.Measures

(If I was going to explain, poorly, the expression above; it is saying for the gallery with all the Level records, for the Level record you selected in that gallery, find all the Measure records related to it... But that might be a completely wrong description of what it is actually doing, but that's how I say it to myself.)

 

GarryPope_6-1637009512310.png

 

 

It then shows me only the Measure records associated with that Level record I selected on the previous screen.
In the screenshots above I selected the "Level 1" record and got two Measure records associated with it "Measure AA" and "Measure BB".

 

GarryPope_2-1637008511777.png

 

As another example, look at the below. I select the "Level 2" record.

GarryPope_4-1637008783032.png


And now get different Measures, "Measure CC", "Measure DD", "Measure EE".

GarryPope_5-1637008855239.png

 

Hope that makes sense?

Canvas apps are not my speciality unfortunately. I'm sure there is a better more elegant way of doing this.

Let me know how you get on. Good luck!

shavora
Super User
Super User

Great walk through, It is so essential with these step by step showcases as a beginner. 🙏

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,034)