cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gijsbert
Level: Power Up

PowerApps : One 2 many relationship between lists and datatable

I am a bit lost on how to get the right informaiton in a data table.

 

I have 3 lists.

- Companies

- AdTypes

- AdLinks

 

A Company can have multiple AdTypes associate to it and an AdType can be associated to multiple Companies. The AdLinks list contains the ID of the Company and the ID of the AdType to handle the proper association. 

 

In the App I'm building there is a Gallery that shows the companies and when you select the company it shows a form with all the details. I now want to have a data table that shows the associated adtypes for the selected Company but am clueless on how to get this into the data table.


Any hints would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Gijsbert
Level: Power Up

Re: PowerApps : One 2 many relationship between lists and datatable

Thanks for the suggestion Mike, in the end I used some pointers out of this post to make it work:

https://powerusers.microsoft.com/t5/General-Discussion/Syntax-for-joining-tables/td-p/61387

 

What I did in the end was:

 

Create a collection that joined the AdType data to the AdLinks information and they used a filter to present it in a gallery.

 

Thanks!

View solution in original post

2 REPLIES 2
Mike8
Level 10

Re: PowerApps : One 2 many relationship between lists and datatable

Hello @Gijsbert,

Check this out and let me know if it helps.


Button1.OnSelect = ClearCollect(ColCompany,{ID:1,text:"Company1"},{ID:2,text:"Company2"},{ID:3,text:"Company3"});
ClearCollect(ColAdTypes,{ID:1,text:"AdType1"},{ID:2,text:"AdType2"},{ID:3,text:"AdType3"},{ID:4,text:"AdType4"});
ClearCollect(ColAdLinks,{CompanyID:1,AdTypeID:1},{CompanyID:1,AdTypeID:2},{CompanyID:2,AdTypeID:2},{CompanyID:2,AdTypeID:4},{CompanyID:3,AdTypeID:1},{CompanyID:3,AdTypeID:3})

DataTable1.Items = ColCompany


DataTable2.Items = Filter(ColAdTypes,DataTable1.Selected.ID in Filter(ColAdLinks,ColAdLinks[@AdTypeID]=ColAdTypes[@ID]).CompanyID)

Gijsbert
Level: Power Up

Re: PowerApps : One 2 many relationship between lists and datatable

Thanks for the suggestion Mike, in the end I used some pointers out of this post to make it work:

https://powerusers.microsoft.com/t5/General-Discussion/Syntax-for-joining-tables/td-p/61387

 

What I did in the end was:

 

Create a collection that joined the AdType data to the AdLinks information and they used a filter to present it in a gallery.

 

Thanks!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,479)