How to "Order By" a runtime column with the "List_SortColumn" widget?

How to "Order By" a runtime column with the "List_SortColumn" widget?

  
Hi everyone,

I have a runtime column in an aggregate query and I would like to sort them with the List_Sort widget, but when I fill the field "Column" in the widget with "{table}.[runtime column]", in runtime give the error that the column doesn't exist.
 
How can i solve this situation?
 
Thank for the help!
 
Best regards.
Can you post your query (at least the select portion) and the column you are trying to sort on?
Izak Joubert wrote:
Can you post your query (at least the select portion) and the column you are trying to sort on?
 Hi Izak,

I submit an image that show the three columns that I use, the first one (Media) is the column that I want to Sort with the widget, the other 2 (Valor and Peso) on the right are the base columns that I use to create the first one. I can sort with the widget every column except the first one.

I hope that I had explain my doubt.

Thanks and best regards.


 
Hi Gonçalo,

Currently dynamic sorts only work with entity attributes, so you won't be able to use the List_Sort widget to sort by your Media column, which is calculated from what I see in the image.

Regards,
Paulo Ferreira
Hi Paulo Ferreira,

thanks for your explanation. 
I will try to figure other way to do this.
 
Regards,
Gonçalo Azambujo



 
Hello @Gonçalo Azambujo.

One way will be to create a attribute on that entitie where you save the value of Media.

Cheers
Hi Gonçalo,

You can use SortRecordList after doing the query passing the result list to the action.
Nuno Rolo wrote:
Hi Gonçalo,

You can use SortRecordList after doing the query passing the result list to the action.
 Hi @Nuno Rolo,

I didn't knew that extension. I'm going explore it! From what searched/read I think will resolve my issue.
 
Thanks!
 
Alberto Ferreira wrote:
Hello @Gonçalo Azambujo.

One way will be to create a attribute on that entitie where you save the value of Media.

Cheers
 Hi great friend Alberto!
 
That's an option...when I structured the database didn't thought on that attribute for the entity, because it would be possible to calculate later on runtime, but now it's an option yes ;) I have only to create an action with  "for each" and calculate/set that value to that entity attribute.

Thanks ;)
 
Hi Gonçalo,

One way of doing it would be to use the sort BY column order You just have to figure out what is the position of the agregate column.

In this example I'm sorting by a count column while grouping by the other so I can use a dynamic sort with ORDER BY 2 or ORDER BY 2 DESC and that will sort by the second column.




Note: This works on SQL Server but I'm not sure about Oracle or MySQL

Hope this helps,
Guilherme
Thanks Guilherme this is totaly new for me!!!
Thanks Guilherme!
I'll try and I come back later to leave feedback.

Best Regards
This same question recently came up during a training session. Glad to know someone had already been on top of it :) Anyway, we also found out that using the name of the calculated attribute worked just fine for the Aggregate Sorting. In the image below, Duration is the calculated attribute.



Cheers!
Pedro,

You are spot on. As you can all see here the dynamic sort can be used with calculated and aggregated columns.

Cheers