cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vrrosales
New Member

Use all items in a list to filter a gallery

Hello Power Apps community! I really need your help.

 

I need to filter a gallery using all the distinct values present in a list, allow me to elaborate:

 

I have a main database with the product, pricing and region information and a secondary database with region and country information, just as follows:

Main database:

ProductPriceRegion
Product A100US East Coast
Product A120US West Coast
Product A150US Gulf Coast

 

Secondary database (region_country referential):

RegionCountry
US East CoastUS
US West CoastUS
US Gulf CoastUS

 

The users must input the country and obtain the products, prices and regions that apply to that country.

 

Today I am using multiple labels (11 total since there are countries that are a part of 11 regions), what happens is as following:

User inputs: US

Label1 = Last(FirstN(Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region),1)).Result

Label2 = Last(FirstN(Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region),2)).Result

Label3 = Last(FirstN(Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region),3)).Result

And then in the gallery:

Filter(Primary_Database, Region = Label1.Text || Region = Label2.Text || Region = Label3.Text) (goes up to 11)

 

My concern is that eventually more regions for a specific country will be introduced and I require a solution that doesn't need for me to create more labels and adding more OR statements in order to retrieve all the data.

 

Therefore, is there a way I can use ALL the items in a list to filter the Gallery?

I need the list to be distinct so something like = Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region) and then use all of the retrieved items to filter the gallery.

 

BTW the main database is over 10k lines but the secondary is around 1k.

 

I appreciate your support!

 

Regards,

vrrosales

2 REPLIES 2
Nogueira1306
Resident Rockstar
Resident Rockstar

Hey! If you have 1 contry and many reagions you could create another combobox for user to choose the region.

You can filter the 2 dropdwon to only show regions from the cpuntry. If a country only has 1 region, the only one that appears is that. I have that filter in a app of mine, I can show you if u want

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Hey Nogueira! 

 

The issue is that the user is oblivious to the regions, I need the result for the "US" input to be all of the products with their prices for all the regions that have US as part of their country. I can't have the users selecting the regions, as I mentioned before there are some countries that can have up to 11 regions associated. Imaging having the user select all of the regions each time they input a new country!!

 

Is there a way to have the application automatically select all available items in a combobox?

 

I appreciate your help!

 

Regards,

vrrosales

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,307)