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

Collections with Related Entities

Hi All,

 

I have a canvas app where I do a ClearCollect() on Accounts from my CDS.  But I then try and use a related entity (Appointments) in a gallery by setting the Items to mainGallery.Selected.Appointments as I have done when using a Data Source directly. It doesn't error, but there's no data for the Appointments.  Is there something I need to do for the collection to get the related data too?  Or is it just the case that it doesn't bring that data on a Collect?

 

If it's the case that by design we don't get related entity data, I can't figure out a way to filter my Appointments by the selected Account.

 

Anyone have any ideas?

 

Thanks...

 

John

2 REPLIES 2
Super User
Super User

Re: Collections with Related Entities

Hi @BigJohn 

You will need to specify exactly the records that you are referencing and since the datasource is different (its now a collection), you will need to use Filter the Foreign key in the appointments gallery by the Primary key in the collection.  Assuming that you have a gallery of accounts with the collection as your Items property.  So the items property of the appointments gallery will be:

Filter(Appointments,accountid=GalleryAccounts.Selected.ID)

 

Community Support Team
Community Support Team

Re: Collections with Related Entities

Hi @BigJohn ,

Do you save your Accounts Entity records into a collection, and then use it as data source in your Main Gallery?

 

Based on the formula you provided, I think there is something wrong with it. There is an known issue that -- when saving CDS Entity reocrds into a Collection, the LookUp field would not be populated with proper values.

 

As an alternative solution, please consider use your Accounts Enitty as data source in your main Gallery instead of the collection. After that, you could use the following formula to retrieve the related Appointment Records for the selected account:

Set the Items property of the second Gallery to following:

MainGallery.Selected.Appointments

Best regards,

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

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 365 members 4,528 guests
Recent signins:
Please welcome our newest community members: