cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pz
Regular Visitor

Reading Many to many relationships in CDS

Hello all. For an app I am building, I require the use of many to many relationships. I am using CDS. I have an entity called "agency" an entity called "tags" and an entity called "tagsmap" that maps tags to agencies and vice versa:

Agency {PrimaryID, name}

tagsmap{PrimaryID, Agency_ (a look up to agency), tag_ (a look up to tags)}

tags{PrimaryID, name}

 

I want to be able to search for tags and get the names of all agencies that have the tag associated. My process right now looks like this:

 

1) fitler tags based on a text string and collect the filtered tags

ClearCollect(TempTags, Search(tags, searchbar.text, "name"))

2) filter tagsmap based on the collection of filtered tags

ClearCollect(TMapResults, Filter('tag map', tag_ in TempTags))

 

This retuns a list of tagsmap entities which have tag entities and agency entities nested within them:

{tagsmap: PrimaryID, Agency_, tag_}

I am stuck here. How do I filter TMapResults in a way that returns agency names?

 

Thanks!

 

 

2 REPLIES 2
v-yamao-msft
Community Support
Community Support

Hi pz,

 

Currently, Common Data Service doesn’t support many to many relationship type, please check the documentation at here:
https://powerapps.microsoft.com/en-us/tutorials/data-platform-entity-lookup/

 

About your scenario, I guess that this thread could be a reference for you:
https://powerusers.microsoft.com/t5/PowerApps-Forum/Many-to-Many-Table-Relationships-in-SQL-Server-D...


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Meneghino
Community Champion
Community Champion

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,623)