Skip to main content
OutSystems

How to use the List_SortColumn widget with an advanced SQL query

Question

How can I use list_sort rich widget with an advanced SQL query?

I see you can use the list_sort widget with an aggregate and the dynamic sort function.

Answer

First to implement the support to the list order in the advanced query you need to define the input in the query that you use in the SQL and you also need to pass to the input the output of the List_SortColumn_GetOrderBy passing the Table Records id and the default attribute to order by (using SQL notation):

list_sort sql querry.png

list_sort sql querry2.png

Remember that to test the query you need to pass hard code in the test parameters the value you want.

After this, you need to implement your layout to sort the columns you have on the table records, for that you need to use the webblock List_SortColumn from Richwidgets that converts the header of the table into an header with the ability to sort the contents. Notice that you need to pass the entity and column associated you want to sort by.

list_sort sql querry3.png

I'm also attaching a version of an eSpace with this working.

https://success.outsystems.com/@api/deki/files/1796/SortList.oml