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 / 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)
  • kadirselcuk Profile Picture
    35 on at

    @v-bofeng-msft 

  • Verified answer
    v-bofeng-msft Profile Picture
    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

     

  • mdevaney Profile Picture
    29,989 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."

  • Giorgio67 Profile Picture
    145 on at

    foto.jpg

  • 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 

     

  • mdevaney Profile Picture
    29,989 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."

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
Kalathiya Profile Picture

Kalathiya 401

#2
WarrenBelz Profile Picture

WarrenBelz 334 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 325 Super User 2025 Season 2

Last 30 days Overall leaderboard