SOLVED

Custom Objects List sorting more than one field

Go to solution
Jayant_Singh
Level 3

Custom Objects List sorting more than one field

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?

Jayant
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom Objects List sorting more than one field

#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.)

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom Objects List sorting more than one field

#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.)