cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rcotgrov
Level: Powered On

Multiple entities / relationships / CDS query

Hi Everybody.

 

Can someone please point me to a guide/template example (or document how it can be done, e.g what to put in the source/item properties) to create the following please using CDS custom data sources and PowerApps.

 

I can't find a guide that uses 2 tables with a relationship example

 

Scenario

Data stored in CDS

 

Custom Entity 1 (Partners) -> Primary_ID       ->   Primary Key

Custom Entity 2 (Contacts) -> Relationship (lookup) created using CDS interface to Partners entity, Partners_Primary_ID   (1 : N)

 

e.g a Partner can have multiple contacts

 

Screen 1

Gallery control uses Partners Entity - User selects a partner record, on_select moves to Screen 2

 

Screen 2

Entity Form (experimental) needs to display N related entries of Selected Partner

 

Also would like to know how to do this with Display/Edit Form too when multiple records will be returned of course with the 1:N relationship please

 

p.s is there a way to script CDS entity/field creation

 

Thanks in advance

 

Loving Powerapps by the way !!!

1 ACCEPTED SOLUTION

Accepted Solutions
JacksonP
Level: Powered On

Re: Multiple entities / relationships / CDS query

I am going to add this on. I was attempting to do something similar and the below article helped me. You can use the look up selected fields in the first gallery to filter the items in the second gallery.

https://powerapps.microsoft.com/en-us/blog/one-to-many-relationships-for-canvas-apps/

 

For the purposes of this explanation, let's assume the first galler is named Partners and the second gallery is named Contacts. For the Contacts gallery, try setting the Items to Partners.Selected.<Contacts field> where <Contacts field> is the filed you want to display from the Contacts entity

 

I hope that helps.

View solution in original post

7 REPLIES 7
Community Support Team
Community Support Team

Re: Multiple entities / relationships / CDS query

Hi rcotgrov,

 

I assume this documentation could be a reference for you:
https://powerapps.microsoft.com/en-us/tutorials/working-with-forms/

 

Please check it and if you need more help, please feel free reply.

 

So far, I haven’t seen a way to create Entity/Field using Script. Maybe you could create an idea at PowerApps Ideas Forum, PGs will check this forum and take it into consideration in future releases:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

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.
rcotgrov
Level: Powered On

Re: Multiple entities / relationships / CDS query

Thanks. The example is with a single entity I think? I'm looking for the way to do this with 2 related entities where I am using a foreign key to obtain data from the other entity.
rcotgrov
Level: Powered On

Re: Multiple entities / relationships / CDS query

 
Anonymous
Not applicable

Re: Multiple entities / relationships / CDS query

Did you ever get this working?  I am trying to do the same thing...

Power Apps Staff CWesener
Power Apps Staff

Re: Multiple entities / relationships / CDS query

Hi rcotgrov,

 

Did the documentation provided help with this issue? Please let me know if there is something we can do to help here.

Thanks,
Clay.
JacksonP
Level: Powered On

Re: Multiple entities / relationships / CDS query

I am going to add this on. I was attempting to do something similar and the below article helped me. You can use the look up selected fields in the first gallery to filter the items in the second gallery.

https://powerapps.microsoft.com/en-us/blog/one-to-many-relationships-for-canvas-apps/

 

For the purposes of this explanation, let's assume the first galler is named Partners and the second gallery is named Contacts. For the Contacts gallery, try setting the Items to Partners.Selected.<Contacts field> where <Contacts field> is the filed you want to display from the Contacts entity

 

I hope that helps.

View solution in original post

TopShelf-MSFT
Level 10

Re: Multiple entities / relationships / CDS query

Thanks so much for sharing your solution @JacksonP!

 

@TopShelf-MSFT

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,400)