cancel
Showing results for 
Search instead for 
Did you mean: 

How sort collection by multiple fields

vinodchinthakin
Level 9
Hi All , Any one can suggest how to Sort Collection for Multiple conditions. For Example Filed1 needs to be Sorted as "Ascending" and Filed2 needs to be Sorted as "Descending" at once. I was able to achieve in Excel(which is called as Custom Sort). How to apply Custom Sorting in BP Collection?

Thanks​​

------------------------------
vinod chinthakindi
------------------------------
1 BEST ANSWER

Best Answers

Carl__Carter
Staff
Staff
Hi Vinod,

You can copy the Sort action in the 'Utility - Collection' business object into a new Action.

Once done, delete the Ascending Order action input and data item, as these are not required for the new action.

Adjust the code start to match the below:

28745.png
When you call the Action, the [Sort Field] Input Parameter would list the fields to sort by and their order. Each field separated by a comma. For example:

[FieldName1] ASC, [FieldName2] DESC


------------------------------
Carl Carter
Senior Developer
Blue Prism
Europe/London
------------------------------

View answer in original post

2 REPLIES 2

Carl__Carter
Staff
Staff
Hi Vinod,

You can copy the Sort action in the 'Utility - Collection' business object into a new Action.

Once done, delete the Ascending Order action input and data item, as these are not required for the new action.

Adjust the code start to match the below:

28745.png
When you call the Action, the [Sort Field] Input Parameter would list the fields to sort by and their order. Each field separated by a comma. For example:

[FieldName1] ASC, [FieldName2] DESC


------------------------------
Carl Carter
Senior Developer
Blue Prism
Europe/London
------------------------------

Thanks Carl, It's worked excellent.!

------------------------------
vinod chinthakindi
------------------------------