List_SortColumn in Advanced Query

Hi everyone,

I am trying to implement Sorting in my table columns without success. I know how to do it in a simple query (good explanation in the tutorials from the Academy) but now I have in hands an advanced query. Could someone help me on how to sort columns from a table that is a result of an advanced query? My problem is mostly in 2 things:
1st - After dragging the Rich Widget's "List_SortColumn" next to the title of my column i need to specify 2 fields in it: "column" and "destination". In the "column" one I wanted to specify it in the following way - {myStructure}.[myColumn] but the output structure of my query doesn't appear in the folder's tree under the box to define a value for the "column" property and autocomplete also doesn't recognize it.
2nd - The advanced query doesn't have the "Order By" folder when clicking on it.

Am I doing something wrong or not thinking in the right way? Can I add the query's input parameter "OrderBy" in my advanced query text with expand inline property or it's not possible?

Luis Fernandes
Hi Luis,

You have to add an input parameter OrderBy and there use List_SortColumn_GetOrderBy(TableRecord.Id,"{TABLE}.[Id]").

Inside the Query you do:

Hope that helps

Hi Luis,

Nuno is correct, but there is one important thing to notice in his screenshot.
The OrderBy input parameter needs to be set with the property 'Expand Inline'. This means that you can send SQL statements through parameters.

Beware that this can lead to sql injection, so you should use the EncodeSQL built-in function: EncodeSql(List_SortColumn_GetOrderBy(TableRecord.Id...))
The 'Expand Inline' is there I didn't give the focus, and the EncodeSql I forgot ;)

Thanks for reminds Joao