Post Closed
76
Views
5
Comments
Solved
Aggregate having more than 1 sort
Application Type
Traditional Web, Mobile, Reactive

I have 1 aggregate with multiple static sorts that have been applied. What will be the answer?

1] aggregate, it is sorted based on "CreationDate". What would happen on adding another sort condition on "Name" attribute?

  1. The second sort condition would replace the first sort condition
  2. It is not possible to have more than one sort condition
  3. For records with the same value in the 'Created Date' attribute will be sorted based on 'Name' attribute
  4. For records with the same value in the 'Name' attribute will be sorted based on 'Created Date' attribute.

Initial 2 options are invalid, I believe option "c" is the correct, please confirm.

2022-01-13 11-06-04
Neha Sheikh
Champion
Solution

Hello,

When you have multiple sorts first sort will get applied. and then on he rows which cannot be sorted based on the first sort, they will get sorted with the second sort, and so on. That is why "C" is correct for me.

Thanks,

Neha

2025-09-21 06-51-05
Mohd Anees Mansoori
Solution

Hello,

Option C is the correct answer.

For records with the same value in the 'Created Date' attribute will be sorted based on 'Name' attribute.

This process will be continued if you apply any 3rd sorting condition, it will get applied on the result of 1st and 2nd sort.

Also refer Link

Hope this helps.

Regards,

Anees

2025-12-17 21-10-06
Shlok Agrawal
Solution

Hey @Pradip Chavhan 

Priority will always be given to the first sort criteria defined. The aggregate will make sure to sort first by Creation date after that the next sort criteria will be used only if 2 or more records have same creation date.

In this you will see that no sorting via Name if there is a different creation date

Please refer the below eg 

Date         Name
01/02/24   AAA
01/02/24  ABB
01/02/24  ACC
02/02/24  CCC
03/02/24  BBB


IN the first 3 records the sort for name is maintained as they have same name and there record creation date is same, but if record creation date is different no sort order wrt Name column will be entertained.

Thanks Shlok

2022-01-13 11-06-04
Neha Sheikh
Champion
Solution

Hello,

When you have multiple sorts first sort will get applied. and then on he rows which cannot be sorted based on the first sort, they will get sorted with the second sort, and so on. That is why "C" is correct for me.

Thanks,

Neha

2025-09-21 06-51-05
Mohd Anees Mansoori
Solution

Hello,

Option C is the correct answer.

For records with the same value in the 'Created Date' attribute will be sorted based on 'Name' attribute.

This process will be continued if you apply any 3rd sorting condition, it will get applied on the result of 1st and 2nd sort.

Also refer Link

Hope this helps.

Regards,

Anees

2022-05-18 07-58-50
Pradip Chavhan

I appreciate, confirming the response. 

2025-12-17 21-10-06
Shlok Agrawal
Solution

Hey @Pradip Chavhan 

Priority will always be given to the first sort criteria defined. The aggregate will make sure to sort first by Creation date after that the next sort criteria will be used only if 2 or more records have same creation date.

In this you will see that no sorting via Name if there is a different creation date

Please refer the below eg 

Date         Name
01/02/24   AAA
01/02/24  ABB
01/02/24  ACC
02/02/24  CCC
03/02/24  BBB


IN the first 3 records the sort for name is maintained as they have same name and there record creation date is same, but if record creation date is different no sort order wrt Name column will be entertained.

Thanks Shlok

2022-01-27 12-58-26
Vikas Khunteta

Hello, 

In the Aggregate, we can consider many columns in sort criteria. Sorting would be done on the basis of Sort Column Order. Just think a simple example that there is one Student Table and having the First Name and Last Name Column. Now, we want to sort the student by First Name and Last Name. In Aggregate, sorting order we need to provide first column as First Name and second one will be the Last Name.