Skip to main content

Notifications

Power Apps - Building 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:
  • kadirselcuk Profile Picture
    kadirselcuk 35 on at
    Re: SortByColumns UerName

    @v-bofeng-msft 

  • Verified answer
    Re: SortByColumns UerName

    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
    mdevaney 29,987 on at
    Re: SortByColumns UerName

    @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
    Giorgio67 145 on at
    Re: SortByColumns UerName

    foto.jpg

  • Giorgio67 Profile Picture
    Giorgio67 145 on at
    Re: SortByColumns UerName

    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
    mdevaney 29,987 on at
    Re: SortByColumns UerName

    @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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard