Sorting recordset to begin with descending a column

I have a recordset. I want to start the recordset sorted by an attribute that is not the id desc. When I put the desc in the preparations of this dataset it does sort it by this attribute but then I cannot sort by any other attribute when the page is open. Can you please provide me the exact steps to sort by an attribute descending when it opens but then give the option to sort the other attributes as well.

Hi Dahlia,

In order to sort by clicking on column header, you'll need to actually program that, it doesn't come out of the box. The easiest way to check how this should be done is to let Service Studio create it for you: open a Web Flow, drag an Entity (e.g. the User Entity) onto the canvas, and inspect the created Screen.

What'll you notice is the RichWidgets\List_SortColumn Widget on the column headers, and a Dynamic Sorting in the query (in the Preperation) containing the List_SortColum_GetOrderBy() Function.

This does not resolve the issue. I have done it this way but I need to sort it desc by an attribute to begin. Please read question and review pictures in attached.


For one, I read your question, and it is not very clear: I went by what I could distill from it, and checked your attachment: in the attachment, there's no List_SortColumn widget, and there's no Dynamic Sorting in the Aggregate.

Secondly, to set the initial sorting, use List_SortColumn_SetOrderBy. You could've easily found that one if you had cared to check the RichWidgets Module that the other Actions are also coming from.

Hi Dahlia,

If you want to start with a specific default sort before the user clicks on any column and you've already implemented the column sort Kilian describes, look at the dynamic sort condition in your aggregate:

The string component is the default sort before a user clicks on any header.

Can you please let me know how to default this descending. I couldn't find the syntax. Thank you

Use the "SetOrderBy" one, like I said. Same syntax as the "GetOrderBy", iirc.

Same thing but add a DESC to the end of your string.

perfect this is what I was looking for. Thank you!

No problem. Please consider setting one of the replies as your answer to make it easier for the next person searching for this, and let us know if you have any more issues.

when I put this in my sort it gives me an internal error in my interface

my code:
List_SortColumn_GetOrderBy(VwActivityLogTable.Id, "{vwActivityLog}.[TransferStartDate] DESC")

This comes from a view so it doesn't have a default identifier - could this be the issue

the actual view is named vwActivityLog

Could you share with us the error you're getting in ServiceCenter? How are you importing this view into OutSystems and how is it named inside your Outsystems espace?