cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MattyH
Continued Contributor
Continued Contributor

Filtering data from 2 entity sources - Data from Dynamics365 entities.

Hi,

 

I am looking to get an app running.

 

I currently have two separate entities, one is for a list of vehicles, and the other is a list of locations (garages and units within an estate, for instance).

 

I am looking to get an app which shows a list of all locations we use, and once a specific location is chosen, then the next page of the app will show all the vehicles that are currently in that location.

 

I just can't seem to find any way to do this, and am getting quite frustrated!!

 

Any ideas would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
TimRohr
Solution Sage
Solution Sage

This seems straightforward... and I say that not to be insulting but to caveat my answer that if it seems so straightforward, I am probably missing the thing that is complicating it for you. If so, post back.

 

But we have to start somewhere, so here is the low-hanging fruit answer.

 

I will assume you have a relationship between your entities (Vehicles looks-up in Locations to get a list of possible locales).

 

First screen:

Add a Gallery that has a datasource of your Locations entity. Put the datasource in your Items property. (Note: there are ways to Sort this output and allow Searching... these methods are built by default if you let PowerApps put together an app for you based on your data... however, assuming you are building this by hand and you are trying to understand things as  you go along, sometimes it's easier just to peel back to the most basic functionality.) I will pretend you have named this Gallery "LocationsGallery."

 

In the OnSelect event of the Gallery, put a Navigate() statement to get to your second screen.

 

Second Screen:

Add a Gallery that has a datasource of your Vehicles entity, but in the Items property, include a Filter() statement to narrow the returns to your chosen Location:

 

Filter(Vehicles,LocationField=LocationsGallery.Selected.yourGUIDField)

 

Again, you can dress that up with Search/Sort later.

 

You don't have to do this in a second screen... the galleries could be on the same screen, but for ease of construction (and similarity to how PowerApps will build you a default app based on your data), I'm suggesting 2 screens.

 

So that part seems straightforward... are you running into trouble with that? Or do you have a more complex situation?

View solution in original post

2 REPLIES 2
TimRohr
Solution Sage
Solution Sage

This seems straightforward... and I say that not to be insulting but to caveat my answer that if it seems so straightforward, I am probably missing the thing that is complicating it for you. If so, post back.

 

But we have to start somewhere, so here is the low-hanging fruit answer.

 

I will assume you have a relationship between your entities (Vehicles looks-up in Locations to get a list of possible locales).

 

First screen:

Add a Gallery that has a datasource of your Locations entity. Put the datasource in your Items property. (Note: there are ways to Sort this output and allow Searching... these methods are built by default if you let PowerApps put together an app for you based on your data... however, assuming you are building this by hand and you are trying to understand things as  you go along, sometimes it's easier just to peel back to the most basic functionality.) I will pretend you have named this Gallery "LocationsGallery."

 

In the OnSelect event of the Gallery, put a Navigate() statement to get to your second screen.

 

Second Screen:

Add a Gallery that has a datasource of your Vehicles entity, but in the Items property, include a Filter() statement to narrow the returns to your chosen Location:

 

Filter(Vehicles,LocationField=LocationsGallery.Selected.yourGUIDField)

 

Again, you can dress that up with Search/Sort later.

 

You don't have to do this in a second screen... the galleries could be on the same screen, but for ease of construction (and similarity to how PowerApps will build you a default app based on your data), I'm suggesting 2 screens.

 

So that part seems straightforward... are you running into trouble with that? Or do you have a more complex situation?

MattyH
Continued Contributor
Continued Contributor

Thanks Tim,

 

That would explain why I was getting frustrated, it was more simple than I thought.

 

I was going all arounmd the houses trying to find a far more complicated solution than that.

 

Matty.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,570)