831
Views
5
Comments
Calculated column + Dynamic Sort
Question

Hi Team,

We have a calculated column which uses a function, so we have assigned it by a loop. We have binded the aggregate to table and now we want to apply dynamic sorting on it. 

How can we achieve this?

Thanks in advance.

2018-10-29 08-31-03
João Marques
 
MVP

Hi Neha,


If you're working on a Traditional Web application, you use the List_Sort column with the name of the calculated field:


And this points to an action that will refresh the query binded to the table. The sort should be something like this:


You should set your Table.Id and then the default sort (in my case, CENumber field from Product entity).


If you are developing a React or a Mobile application, you just need to link the header cell of your table to the field you want to order. In my example below, clicking on this header cell, will order by Name field from User entity. In your case you would select the calculated field you added:

and the query should have the order binded to a text variable (in my example TableSort):



You bind your table to a OnSort client action:



And that action orders:

Hope it helps.


Cheers,

João

2023-12-11 08-54-13
Neha Agrawal
Champion

João Marques wrote:

Hi Neha,


If you're working on a Traditional Web application, you use the List_Sort column with the name of the calculated field:


And this points to an action that will refresh the query binded to the table. The sort should be something like this:


You should set your Table.Id and then the default sort (in my case, CENumber field from Product entity).


If you are developing a React or a Mobile application, you just need to link the header cell of your table to the field you want to order. In my example below, clicking on this header cell, will order by Name field from User entity. In your case you would select the calculated field you added:

and the query should have the order binded to a text variable (in my example TableSort):



You bind your table to a OnSort client action:



And that action orders:

Hope it helps.


Cheers,

João

 Hi João,

I am working on the traditional web.  The approach you suggested works for calculated columns in aggregate.


We have a calculated column in aggregate with by default empty values and we are calculating this column after aggregate to render on UI as it is calculated using complex function logic.

We are trying to achieve dynamic sorting on this calculated column.

Thanks in advance!

2018-10-29 08-31-03
João Marques
 
MVP

Hi Neha,


If you're calculating this field outside of the aggregate, you can then order the field using ListSort from System:



You pass your list on the List field, select that calculated field on the By field, and on Ascending True for ASC, False for DESC.


Hope it helps.


Cheers,

João

2023-12-11 08-54-13
Neha Agrawal
Champion

João Marques wrote:

Hi Neha,


If you're calculating this field outside of the aggregate, you can then order the field using ListSort from System:



You pass your list on the List field, select that calculated field on the By field, and on Ascending True for ASC, False for DESC.


Hope it helps.


Cheers,

João

Hi  João,

The sorting should be performed on the header click.


I achieved this using I have calculated the value and stored it in a temporary table with a session, cleaned up the extra entity created when the session is expired.


Thanks for the solutions provided.

 

2023-04-07 07-55-02
Krushna Mantri

Hi Neha,

you can give a try to List_SortColumn_SetOrderBy action(which is in the rich widgets module), so you need to add the same in the action which is triggered after header click and pass Table id, calculated column and toggle the order direction(keep order in a local variable like Order = Asc and for toggling if(order=ASC, DESC, ASC)) there

hope that will solve your problem

Regards,

Krushna

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.