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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SortByColumns UerName
Power Apps
Answered

SortByColumns UerName

(1) ShareShare
ReportReport
Posted on by 145

Hi everydoby

I should order table's field UserName

I added an ico 

Onselect:

 Set(varOrderColum;"UserName");;

UpdateContext({sortDescending1: !sortDescending1})

 

and for table:

Items:

SortByColumns(

Filter(db_List;StartsWith(Stato.Value; drpState.Selected.Value) );

varOrderColum;Ascending)

 

but it doesn't order for UserName.  Do you have some suggestion?

Many thanks

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Giorgio67 
    What type of data is UserName in SharePoint?  A single-line text?  A person type?

    Can you please show a s screenshot of what happened when you tried the code?

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Giorgio67 Profile Picture
    145 on at

    Hi mdevaney

    in the List is UserName get by Sharepoint (Active Directory); person not group

    and in the table as list

     

     

    When I click on order ico, the table's box became empty 

     

  • Giorgio67 Profile Picture
    145 on at

    foto.jpg

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Giorgio67 
    You can't use SORTBYCOLUMNS on a complex type like SharePoint Person fields.  Its just not possible...

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Giorgio67 :

    As @mdevaney mentioned,it is not available to SORTBYCOLUMNS on a  Person field.

    I have two alternatives:

    Solution1:

    Onselect:

     Set(varOrderColum;"TheUserName");;

    UpdateContext({sortDescending1: !sortDescending1})

    Items:

    DropColumns(

    SortByColumns(

    AddColumns(Filter(db_List;StartsWith(Stato.Value; drpState.Selected.Value) );UserName.DisplayName;"TheUserName");

    varOrderColum;Ascending);

    "TheUserName")

    Solution2:

    Items:

    Sort(Filter(db_List;StartsWith(Stato.Value; drpState.Selected.Value) );UserName.DisplayName;Ascending)

     

    Best Regards,

    Bof

     

  • kadirselcuk Profile Picture
    35 on at

    @v-bofeng-msft 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard