cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
agent3154
Level: Powered On

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
Community Support Team
Community Support Team

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
Community Support Team
Community Support Team

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

agent3154
Level: Powered On

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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,526)