cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JJJ04
Frequent Visitor

Sorting gallery when also filtering with IsBlank

Hello everyone,

 

Hoping someone can assist as I have tried other user's remedies but they don't seem to work for me.  I have a SharePoint list where it only pulls items to the gallery where the Review Complete column is blank.  This works perfectly however I want the results in the gallery to also be sorted in alphabetical order by another column (a choice field) in the same list.

 

This is what I currently have but not sure how to incorporate the sort feature:

 

Filter('Hotel Reviews', (IsBlank('Review Complete')))

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JJJ04
Frequent Visitor

@BCBuizer Okay i think i got it!  

 

Sort(Filter('Hotel Reviews',(IsBlank('Review Complete'))), Hotel.Value)

 

I changed it from "SortByColumns" to Just "Sort" and then added ".Value" after the column I wanted it sorted by. 

I am very new to Powerapps.  Is there a reason why your original formula didn't work but this did? 

View solution in original post

5 REPLIES 5
BCBuizer
Super User
Super User

You can nest your filtered results in a SortByColumns function:

SortByColumns(

Filter('Hotel Reviews', (IsBlank('Review Complete')))

, "Other Column")
JJJ04
Frequent Visitor

When i do that, the gallery comes up blank for some reason with no results?

JJJ04
Frequent Visitor

@BCBuizer Okay i think i got it!  

 

Sort(Filter('Hotel Reviews',(IsBlank('Review Complete'))), Hotel.Value)

 

I changed it from "SortByColumns" to Just "Sort" and then added ".Value" after the column I wanted it sorted by. 

I am very new to Powerapps.  Is there a reason why your original formula didn't work but this did? 

zmansuri
Super User
Super User

 

SortByColumn(AddColumn(Filter('Hotel Reviews', (IsBlank('Review Complete'))),"OtherText",OtherColumn.Value),"OtherText",Ascending)

Changing from SortByColumns to Sort probably didn't fix it, but adding the ".value" did.

 

Looking at the syntaxis for SortByColumns, it needs a string to sort. Since the Hotel column is a of a record datatype, you can't use that "as is", but adding the ".value" does return a string and hence works.

 

More info on Sort and SortByColumns can be found here: 

 

Sort and SortByColumns functions in Power Apps - Power Apps | Microsoft Docs

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,926)