cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
Advocate II
Advocate II

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)

 

Anonymous
Not applicable

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. 

@Anonymous - 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.

Anonymous
Not applicable

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 

@Anonymous 

 

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (109,456)