Custom Objects List sorting more than one field | Community
Skip to main content
Level 5
May 28, 2020
Solved

Custom Objects List sorting more than one field

  • May 28, 2020
  • 1 reply
  • 1552 views

In CO list, there are total eight field in which one field is date and second field item type. Business requirement is to sort it based on item type first after that again sort it by date field type.

custom objects(default_c) ,

field

Date(date),

Item Type(itemType)

 

And, counter is running for up to two times.  what will be best way to sort it again and again in Velocity script?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman
#set( $mySortedList = $sorter.sort( $myList, ["field1","field2"] ) )

 

Note this is all functionality built into SortTool — you don't need to (nor do you have to, at least typically) write your own sorting routine.

 

(It's also one call to $sorter.sort, you don't see the comparisons happening as that's all under the hood.)

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
May 29, 2020
#set( $mySortedList = $sorter.sort( $myList, ["field1","field2"] ) )

 

Note this is all functionality built into SortTool — you don't need to (nor do you have to, at least typically) write your own sorting routine.

 

(It's also one call to $sorter.sort, you don't see the comparisons happening as that's all under the hood.)