Post Closed
155
Views
8
Comments
How to sort calculated columns using List_SortColumn

I am trying to sort a column that is calculated using List_SortColumn. The value of the columns is coming from a server action then rendered using an Expression widget.

Here is where the value of the column calculated:

I tried putting the action in the column attribute of the List_SortColumn widget but it doesn't work


Any suggestions?

2022-07-22 08-49-20
Laura Fidalgo

Hey,

Are you using only expressions with functions? Don't you have a full list?

To use that, you need to give the column name, not the value that you want to show in an expression. Like, if I have a list of users, and want to sort by username, that 'column' value will be User.Username, and not the attribute's value.

To use List_SortColumn, you need a list.

Cheers

2022-06-29 08-33-18
Gabriel Onell David

I have a full list but three of my columns were calculated (came from a server action). The sorting worked on my columns like employee number which is {Employee}.[EmployeeNumber]. But on my other columns, they are calculated dates.

2022-07-22 08-49-20
Laura Fidalgo

You should calculate them inside an aggregate or a sql, otherwise you won't be able to sort because they're not part of a list 

2021-12-07 07-28-47
Arnold Ayaoan Jr

Hi Gabriel,

I would suggest you convert GetAssessmentStartDate action to become an aggreagate/sql calculated column as part of your query in retrieving your table datasource. 

Regards,

Arnold

2022-06-29 08-33-18
Gabriel Onell David

I have a new problem now that I followed your suggestion to convert the action into an sql query. My problem is, I used structure to fetch the calculated values. How do I sort those with List_SortColumn?

2026-02-26 06-29-24
Rahul
 
MVP