cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
derek1
Frequent Visitor

Filtering Contacts based on current item

Hi, I've very new to PowerApps so apologize if I have not posted enough information to solve.

 

I've been struggling with this for a days now and can't seem to figuire out this seemingly simple filter.

 

I am displaying all Contacts in a Gallery within a Datacard.  I am trying to filter the Contacts for only the current rental unit (DataCardValue151)

 

Would appreciate your help.  Thanks!

 

Let me know if you need any more information.

 

Derek.

3 REPLIES 3
RandyHayes
Super User
Super User

@derek1 

Is there some corresponding column in your Contacts that would relate the contact to the unit?  You will need that - or an alternate list to store that information.

 

If you do - let's say you have a UnitNumber column in your Contacts list, then you can set the filter on your Gallery to something like this:

Filter(Contacts, UnitID = ThisItem.UnitID)

 

The above assumes two things: 1) You have a UnitID in the Contacts list and 2) That you have a UnitID in the underlying record that you are editing.  If anything differs from your scenario, then adjust accordingly.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
derek1
Frequent Visitor

My relationships are a little nested.  Maybe thats why I have been having so much difficulty.

 

Relationships are as follows:

 

Tables: Contacts <--> Leases    Entities: cr0e2_leases <--> cr0e2_leaseid

Tables: Leases <--> Rental Units    Entities: cr0e2_rentalunit <--> cr0e2_rentalunitid

 

Thanks for your help. 

RandyHayes
Super User
Super User

@derek1 

Yes, so then you will need to get the list of leases from the rental unit id and then the list of contacts based on the lease id.

Something along this line would get you going...

Filter(Contacts, leaseid in Filter(Leases, rentalunitid = ThisItem.UnitID).leaseid)

Of course, substitute the above names with those that match your names in the app.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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