cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Madumi
Advocate II
Advocate II

Narrow gallery to autonumber multiple matches

I'm unsure whether this is a Filter, Search, Lookup or something else situation.

 

I have a N:N relationship between two Entities: "Agency" and "Agency Contact," and I would like to list the Agency Contacts in a powerapp gallery on the basis of when a user selects an individual Agency.

 

The relationship between the two Entities is formed by an intermediary Entity "Agency Contact List." This Entity stores the Agencies with their respective multiple contacts (using the primary keys for Agency and Agency Contact--which are auto-numbers).

 

1) How would I retrieve multiple primary keys (from "Agency Contact List") based on the selected "Agency"?

 

2) How would I list the Agency Contacts (in a gallery) which correspond to those multiple primary keys?

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User
Super User

Hi,

 

Just to make sure I understand your first question, are you asking how to retrieve multiple records for a given Agency? By primary keys, are you saying primary keys of agency contact lists since there can be many records for a given agency?

 

If so, assuming Agency is a field in Agency Contact List, you could use an expression similar to the following:

Filter('Agency Contact Lists', Agency.AgencyID = SelectedAgency.AgencyID)

Assuming Agency is the name of the lookup field in the Agency Contact Lists entity and AgencyID is the primary key. 

 

After populating your gallery with the Items property set with the above expression, you should be able to display the Agency Contact and Agency for each filtered record of Agency Contact Lists with an expression similar to the following (assuming Name is a column within the Agency entity):

ThisItem.Agency.Name
ThisItem.Contact.'Full Name'

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
https://www.thepoweraddict.com

 

 

View solution in original post

1 REPLY 1
PowerAddict
Super User
Super User

Hi,

 

Just to make sure I understand your first question, are you asking how to retrieve multiple records for a given Agency? By primary keys, are you saying primary keys of agency contact lists since there can be many records for a given agency?

 

If so, assuming Agency is a field in Agency Contact List, you could use an expression similar to the following:

Filter('Agency Contact Lists', Agency.AgencyID = SelectedAgency.AgencyID)

Assuming Agency is the name of the lookup field in the Agency Contact Lists entity and AgencyID is the primary key. 

 

After populating your gallery with the Items property set with the above expression, you should be able to display the Agency Contact and Agency for each filtered record of Agency Contact Lists with an expression similar to the following (assuming Name is a column within the Agency entity):

ThisItem.Agency.Name
ThisItem.Contact.'Full Name'

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
https://www.thepoweraddict.com

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,242)