cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tbadey
Level: Powered On

Filtering Powerapp Gallery with Dropdown

Hello, 

 

I Have a Sharepoint list named "Duty Response" and have created a galllery in Powerapp that lists that content. The search function appears to be working fine, but I would really like to add a dropdown box that filters the gallery by the choice in one of my SharePoint list columns. The choices are "FYI" "In Progress" and "Complete"

 

The choices are in a column on the SP list called "Action Required"

 

In the gallery, these are shown in Body1

 

My items properties for the dropdown is ["FYI", "In Progress", "Complete"]

 

items for BrowseGallery1 is SortByColumns(Filter([@'Duty Response'], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

I tried setting the gallery item property to 

Filter('Duty Response','Action Required' = Dropdown2.Selected.Value)

 

Also tried the same formula for the On Change of the dropdown. Nothing seems to be working 

 

 How do I get this gallery to display properly? Gallery should show only items with FYI status if FYI is selected in the dropdown. Likewise if In Progress or Complete are selected.

 

Any help would be greatly appreciated, ive been trying to figure this out for days 

 

5 REPLIES 5
denglish
Level: Powered On

Re: Filtering Powerapp Gallery with Dropdown

Choice columns from a SharePoint list are brought in as objects, much like a lookup field. You will need to specify .Value or .Id.

 

Try: Filter('Duty Response','Action Required'.Value = Dropdown2.Selected.Value)

 

tbadey
Level: Powered On

Re: Filtering Powerapp Gallery with Dropdown

Thank you so much! That got the dropdown to finally work! 

 

However it looks like it eliminated the search function. I was able to get that to work on a different screen with the formula 

SortByColumns(Filter([@'Duty Response'], StartsWith('Guest Name', TextSearchBox1.Text)), "Title")

 

Is there a way to nest these together? Ideally i would like to be able to search by Guest Name, Filter results by Dropdown (Thank you!) and get the sort button to sort by date, oldest to newest, or vice versa. 

 

If it helps, the SP column for date sorting is called "Response Date" 

 

Thank you for the help, really new with powerapps, and just cant seem to figure this stuff out. 

denglish
Level: Powered On

Re: Filtering Powerapp Gallery with Dropdown

@tbadey - Applying multiple filters and sorting is absolutely possible.

 

You can add additional filters with logical operators (&&, ||, And, Or) within one formula or you can pass multiple conditions as additional formula parameters to Filter(). The latter way returns records from the table given in the first parameter for which all formulas return true.

 

Example 1: Filter(Data, Condition1 && Condition2)

Example 2: Filter(Data, Condition1, Condition2)

 

Putting it all together, something like the following should work for you:

 

SortByColumns(Filter('Duty Response', 'Action Required'.Value = Dropdown2.Selected.Value, StartsWith('Guest Name', TextSearchBox1.Text)), "Response Date", Ascending);

 

I should mention, using StartsWith() will introduce a delegation issue. Normally I would recommend using a logical operator instead of a PowerApps function, but the operator, "in", also introduces a delegation issue. Make sure you understand Delegation and how it affects the retrieval of records from a Data Source.

tbadey
Level: Powered On

Re: Filtering Powerapp Gallery with Dropdown

THANK YOU! 

 

Now it does exactly what i need it to, one exception, and then i think this is finally complete. There doesnt seem to be a way to get an "all" option for the dropdown that shows all values (FYI,In Progress, Complete) if selected 

 

Dropdown item: ["FYI", "In Progress", "Complete"]

 

Gallery Item: SortByColumns(Filter([@'Duty Response'],'Action Required'.Value = Dropdown3.Selected.Value, StartsWith('Guest Name', TextSearchBox1_2.Text)), "Date", Descending)

 

you deserve a sainthood 

denglish
Level: Powered On

Re: Filtering Powerapp Gallery with Dropdown

@tbadey 

 

I would experiment with adding a record to the Items sourced to the Dropdown. Or you could use a conditional statement to only apply the filter if the Dropdown has a selected value. Otherwise, all records will show.

 

Hopefully that gets you where you need to be! If one of my replies helped you with your issue, could you please mark it as the solution to close out the thread?

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,048)