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

SortByColumns UerName

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

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

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

 

View solution in original post

6 REPLIES 6
mdevaney
Super User
Super User

@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."

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 

 

foto.jpg

@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."

v-bofeng-msft
Community Support
Community Support

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

 

View solution in original post

kadirselcuk
Advocate I
Advocate I

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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