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 / Need better understand...
Power Apps
Unanswered

Need better understanding of how the Default Sort button works and if it can be changed

(1) ShareShare
ReportReport
Posted on by 99

Still struggling to understand all of the unique ways this PowerApp thing works.  I have restarted my project way too many times out of frustration.  I have a simple SharePoint list.  I now understand there is a required TITLE field however I am not going to populate it with anything.  It appears that when using the wizard to build the initial app, the sort button (the up and down arrows) use that TITLE field to sort the various records.  Can you change this to sort on a different field and still have the little button control it?  It also seems that the default SEARCH field also uses this same field but I do not understand enough about yet to change it.  Any suggestions on how to better learn how these canned features functions?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @spectraflame ,

    In the Item property of the Form (top left drop-down), change Title to whatever field/s you want to sort and search on. Also in the SharePoint List Settings (option in cog at top right bar), you can change the requirement for Title to always contain data.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Yes, you can easily change those functions to point at other columns.

    1) For the Sort. If you look at the items property of the Gallery you will see something that looks like the following:

    SortByColumns(Filter([@Dogs], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

     where [@Dogs] is my list.  Simple change the "Title" entry to the name of a different sortable column, like another single line of text.

    2) for Search. In the same property you see the function StartsWith(). The first entry is Title. Change that to a different single line of text column and you will be able to search on it.

  • spectraflame Profile Picture
    99 on at

    I have tried that several times but it still gives an error.  I have a field that is called DEPARTMENT.  It is currently the field that is labeled BODY in the Gallery.  If I change the following from:

    SortByColumns(Filter([@'VEHICLE INSPECTIONS'], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
    to
    SortByColumns(Filter([@'VEHICLE INSPECTIONS'], StartsWith(Title, TextSearchBox1.Text)), "DEPARTMENT", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
     
    It states there is an error (see attached image)
     
    I also do not have a function called StartsWith() in the Gallery that I can find.
  • spectraflame Profile Picture
    99 on at

    Currently the ITEM in the Gallery is set to:   ThisItem.Title.  I have tried to change it to ThisItem.Department.Value to search by the Department field.  This changes the displayed text within the Gallery, however has no impact on the sort button.

     

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    @WarrenBelz was talking about the form, which is the second and third screen. See my response below for what you need to change on the gallery.

  • spectraflame Profile Picture
    99 on at

    @Pstork1I do not see anything below your response.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Can you show a screenshot of what you did have in the original Items property of the gallery when you built the app?  Also what type of field is Department? Is it a Single line of text or choice or what?

  • spectraflame Profile Picture
    99 on at

    @Pstork1 

    PowerAppGallery4 shows the default layout from what the template imported.  This shows the TITLE field and what it is set to.  Within the SharePoint, I added Text just to see how the sort and search work but moving forward that field will be blank.

     

    PowerAppGallery5 shows the ITEMS with the default SortByColumns function.  The "TITLE" in red is what I attempted to change to DEPARTMENT but that generated an error.

     

    PowerAppGallery6 shows that DEPARTMENT is a valid field in the SharePoint list.  This is configured on the SharePoint side as a Choice box to control input.

     

    Would like to be able to sort on Department and Search by the Department field.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    OK, the problem is that Department is a choice column. Choice columns are not simple text, they are a complex object that has both and index and a value.  So to search on them you need to access the Value property of the Choice column.

     

    that also causes a problem with SortByColumns since its a complex column. So you either need to AddColumns() to create a single text column with the value or switch to Sort().

     

    Here's the final code using Sort() and the Department.Value instead of Department.

    Sort(Filter([@'VEHICLE INSPECTIONS'], StartsWith(DEPARTMENT.Value, TextSearchBox1.Text)), DEPARTMENT.Value, If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
  • spectraflame Profile Picture
    99 on at

    So would you recommend creating a single text column that would duplicate/copy the value from the Choice Box to simplify the sort or filter?

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