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

Sortbycolumns sorts lower upper and proper separately

I was building a powerapp for a long standing sharepoint list that is quite large. And I found that it sorted things in all lower case, then proper, then all caps. So like smith it was

 

smith, richard

Smith, A

Smith, Bob

Smith, John

SMITH, ANDREW....

etc

 

Is there some way to get it to sort it together?

 

Here’s my command

 

SortByColumns(ColRecruitmentState,”Last_x0020_Name”, Ascending, “First_x0020_Name”, Ascending,”State”, Ascending)

 

I tried putting Upper() around the last name column but it threw an error.  Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @BethanyJake 

To sort by the upper cased lastname and firstname, you can add columns that contain the upper cased representation of the lastname and firstname columns, and then sort by those.

The syntax would look like this:

SortByColumns(AddColumns(ColRecruitmentState,
                         "LastNameUpper",
                         Upper(Last_x0020_Name),
                         "FirstNameUpper",
                         Upper(First_x0020_Name)
              ),
              "LastNameUpper",
              Ascending,
              "FirstNameUpper",
              Ascending,
              "State",
              Ascending
)

Hopefully, this will take you a bit further.

View solution in original post

2 REPLIES 2
timl
Super User
Super User

Hi @BethanyJake 

To sort by the upper cased lastname and firstname, you can add columns that contain the upper cased representation of the lastname and firstname columns, and then sort by those.

The syntax would look like this:

SortByColumns(AddColumns(ColRecruitmentState,
                         "LastNameUpper",
                         Upper(Last_x0020_Name),
                         "FirstNameUpper",
                         Upper(First_x0020_Name)
              ),
              "LastNameUpper",
              Ascending,
              "FirstNameUpper",
              Ascending,
              "State",
              Ascending
)

Hopefully, this will take you a bit further.

BethanyJake
Frequent Visitor

Thanks! that worked perfectly.  I hadn't thought of adding a column to make it work but it took care of it cleanly!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,208)