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
Super User
Super User

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (5,134)