web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps - Sort and F...
Power Apps
Unanswered

PowerApps - Sort and Filter Galleries

(0) ShareShare
ReportReport
Posted on by

So I have the gallery before and I Want to sort Ascending/descending by the Employees Name (which is the Author column in SharePoint) but when i press the sort button, this is what happens:

SLCLARKE_0-1642169367858.png

Also for the search, i want to be able to type persons name in and it filters for them but that also doesn't work.

 

This is the formula:

 

SortByColumns(Filter([@'Compliance Team Leave Requests'],StartsWith('Title',TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

Any ideas?

 

SLCLARKE_1-1642169476108.png

 

Categories:
I have the same question (0)
  • Verified answer
    VeGETzX Profile Picture
    367 on at

    You must specify which column to search with your StartsWith function, and the Author column is a person column that contains all of the author including DisplayName, Email, etc. In this case you want to search by Author DisplayName, so use 'Author.DisplayName'.

     

    And, for SortByColumns to work, you must replace "Title" with the column you want to use for sorting (Author.DisplayName), but you cannot use "Author.DisplayName." This is where AddColumns comes in; it will extract the Author.DisplayName from the person column and stored it in a new column called "AuthorDisplayName," which you can use for sorting.

     

    Try put this code into Items property of your gallery.

     

    SortByColumns(
     Filter(
     AddColumns(
     [@'Compliance Team Leave Requests'],
     "AuthorName",
     Author.DisplayName
     ),
     StartsWith(
     Author.DisplayName,
     TextSearchBox1.Text
     )
     ),
     "AuthorName",
     If(
     SortDescending1,
     Descending,
     Ascending
     )
    )

     

     

     

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @Anonymous your function is sorting "Title" and not author hence the sequence you have, based on the title being annual leave and TOIL. replacing the title with author as per @VeGETzX it will sort as you want it to. the Author.DisplayName  being the 'Employee Name'.DisplayName

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Anonymous,

    Could you please tell me that if you want to search and sort by the 'Name of Employee' column in your list?

     

    The StartsWith() function you provided should reference to the 'Name of Employee' column directly as below:

    SortByColumns(AddColumns(Filter([@'Compliance Team Leave Requests'],StartsWith('Name od Employee'.DisplayName,TextSearchBox1.Text)),"EmployeeName",'Name od Employee'.DisplayName), "EmployeeName", If(SortDescending1, Descending, Ascending))

    You should know that a Person column could not be supported in SortByColumns() function, so I add a temporary text column instead.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard