Sorting list on multiple columns

Sorting list on multiple columns

I am facing issue with displaying the list record sorted on two columns.

I have used SortRecordList which allows me to sort on one column only.

Please suggest a quick solution. My purpose is to achieve below

select scheulded-date, actual-date from datetable order by scheulded-date, actual-date desc
Consider having a third column in your RecordList (hidden from the UI), formed by concatenating your two columns that you wish to use for sorting. Then you can use SortRecordList on this (hidden) column.
Hi Paulo, thank you for your comment. We understand that it will work with string values.

However we have both the colums as DateTime. How can we concatenate the datetime values for sorting?

If you iterate (for..each) through your RecordList, you can assign the values to this sorting column. Just concatenate the datetime components - you can use these built-in actions:

Year(), Month(), Day(), Hour(), Minute(), Second()
Add padding (with a fixed number of digits) where necessary - for example, if month = 3, generate "03", so it can be correctly sorted against month "10". This built-in function can help you with this:


However, if you can do this in the database, while retrieving the data, it will be easier. Take this query, for example (tested under Sql Server):

      convert(varchar, {User}.[Creation_Date], 120), ', ',
      convert(varchar, {User}.[Last_Login], 120))
order by

Query's output structure (last column is of type text):

Example output:

This would allow you to use SortRecordList later on column SortInfo. Of course, this list would be aready sorted from the database query in the first place, but I assume you need to manipulate it afterwards and re-sort it.

Newer versions of SortRecordList support multiple column sorts.

Justin James wrote:
Newer versions of SortRecordList support multiple column sorts.

 May i have a download link for that new version of SorRecordList?

JD I think Justin is talking about this item in forge

Mark -

Yes, that's the one I meant. Older versions did not support multi-column.

Btw, that was because of a silly bug. I've used the older version, and one change was enough to make it work. As I've written on the forge discussion, I've made a rewritten version that can sort on arbitrary fields in nested records, but in this case that doesn't seem needed.
Mark Bayles wrote:
JD I think Justin is talking about this item in forge
 Is this included in the newer versions or do we have to download this separately?
Not included. You have to download the component from the forge.
And, if you need sorting on nested records, you could use the version I posted there.