cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Powerapp DataTable Sort By Author Display Name

Hi, 

    I have been researching on this issue but have not found an answer. How do you sort by author in a datatable that is connected to a sharepoint list? 

    The Item property for this datatable is:

 

SortByColumns('listName',sortBy,If(order,Ascending,Descending))

   So If I want to sort the data table by a column named "Place", I would just change the onSelect of a button to 

 

 

UpdateContext({sortBy:"Place",order:!order})

   All other column works as well. However , if I do    

UpdateContext({sortBy:"Author.DisplayName",order:!order})

 

  It will display noData text. 

 

Is there anything that I can do to make this work? 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Powerapp DataTable Sort By Author Display Name

Hi @agent3154,

 

I have made a test and the issue is confirmed on my side. 

 

The SortByColumns function is used to sort a table based on one or more columns. For the ColumnName argument part of this function, you should provided a Column name, but the "Author.DisplayName" formula that you provided doesn't represent a column name.

 

In addition, if we sort the list items based on the Author column using the SortByColumns function, the error would show up as below:6.JPG

 

So, if you want to sort list items based on the Author column using the SortByColumns function, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, please take a try with the following workaround:

 

Set the Items property of the Data table control to following formula:

Sort('20180725_case11',Author.DisplayName,If(order,Ascending,Descending))

Set the OnSelect property of the Button control to following formula:

UpdateContext({SortBy:"",order:!order})

More details about the Sort function, please check the following article:

Sort function

 

 

Best regards,

Kris

 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Powerapp DataTable Sort By Author Display Name

Hi @agent3154,

 

I have made a test and the issue is confirmed on my side. 

 

The SortByColumns function is used to sort a table based on one or more columns. For the ColumnName argument part of this function, you should provided a Column name, but the "Author.DisplayName" formula that you provided doesn't represent a column name.

 

In addition, if we sort the list items based on the Author column using the SortByColumns function, the error would show up as below:6.JPG

 

So, if you want to sort list items based on the Author column using the SortByColumns function, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, please take a try with the following workaround:

 

Set the Items property of the Data table control to following formula:

Sort('20180725_case11',Author.DisplayName,If(order,Ascending,Descending))

Set the OnSelect property of the Button control to following formula:

UpdateContext({SortBy:"",order:!order})

More details about the Sort function, please check the following article:

Sort function

 

 

Best regards,

Kris

 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Advocate I
Advocate I

Re: Powerapp DataTable Sort By Author Display Name

Hi @v-xida-msft,

     Thank you for the workaround solution. This works if there is no need to sort by other columns, unfortunately it is case for my app. I tried 

Sort('20180725_case11',sortBy,If(order,Ascending,Descending))

and then Onselect to

 

UpdateContext({SortBy:"Author.DisplayName",order:!order})

Does not seem to work. 

I guess I will leave the author column for now since there are a lot more other columns.  

Anyway, thanks for you help mate!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020 Winner Announced

Check it out!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,006)