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

Filter and Sort not working for BrowseGallery1

Trying to add a filter based on a column in the list my app is pointing to.  The column name is Status.  If I add a filter section from what I've read in documentation, this does not work and blanks out everything.  Here is what I have currently.

 

SortByColumns(Search('Laptop/Surface Pro Tracking', TextSearchBox1.Text, "Title"), "Title", If(SortDescending1, Descending, Ascending)) 

 

I want to keep the sort by Title, but have it filter to Status<>Decommissioned where it will exclude that status on BrowseGallery1.  I also want  to keep the search on the Title which I am using as the device asset tag.  Here is what I've tried so far:

 


SortByColumns(Search('Laptop/Surface Pro Tracking', TextSearchBox1.Text, "Title"), Filter( 'Laptop/Surface Pro Tracking', TextSearchBox1.Text in Text( Status <> Decommissioned )), If(SortDescending1, Descending, Ascending))

 

or

 

Sort(Filter( 'Laptop/Surface Pro Tracking', TextSearchBox1.Text in Text( Status <> Decommissioned ))), Title, If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

 

Any thoughts on what I might need to do? 

9 REPLIES 9
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Filter and Sort not working for BrowseGallery1

Welcome to the PowerApps Community, wpotter!

 

You need to nest your Filter function inside the Search function. The key to understanding how to do this is when you realise that Search's first parameter the data source can also be the result of another function. Check it out below:

 

SortByColumns(Search(Filter('Laptop/Surface Pro Tracking', Status <> "Decommissioned") TextSearchBox1.Text, "Title"), "Title", If(SortDescending1, Descending, Ascending))

 

NB: Your Filter condition, Status <> "Decommissioned" also needed to have quotes around Decommissioned, which makes it a string literal.

Highlighted
New Member

Re: Filter and Sort not working for BrowseGallery1

That did not work.  The Browse gallery goes blank again and I get some errors on the formula

 

"The Function 'Search' has some invalid arguments."

 

"Suggestion: Part of this formula cannot be evaluated remotely due to service limitations.  Highlighted operation is not supported by column 'Status'."

 

This was after copy and pasting your suggestion. 

 

Highlighted
New Member

Re: Filter and Sort not working for BrowseGallery1

To add, both Status and Title are the column names in the sharepoint list.  I see Title is in quotes, but not Status. 

Highlighted
New Member

Re: Filter and Sort not working for BrowseGallery1

So the blue highlight went from Status to the <>.  It doesn't seem to like that.  != doesn't work either.  Is there another item we should use for "does not equal" ?

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Filter and Sort not working for BrowseGallery1

I'm making a test app now. What's your data source?

Highlighted
New Member

Re: Filter and Sort not working for BrowseGallery1

It's a SharePoint List. 

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Filter and Sort not working for BrowseGallery1

Sorry I did see that above but you replied too quickly...

 

Can you please confirm the column type of Status, is it a Single line of text, Choice, Lookup...?

Highlighted
New Member

Re: Filter and Sort not working for BrowseGallery1

It's choice, sorry.

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Filter and Sort not working for BrowseGallery1

OK, if you replace the Status <> "Decommissioned" with the below code you'll see a blue line and a similar message to the one above, but it does actually work for me:

 

Not("Decommissioned" in Status.Value)

 

Note that all Choice columns need to have the .Value appended to access your value.

 

Let me know if this works for you

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,601)