Knowledge folders name sorting algorithm

What is the current algorithm used for sorting knowledge folder names? Cathay Pacific business users are interested in organizing folder names based on integer values. Specifically, they would like to sort folders in the order of 1, 2, 3, 4, 5, 10, 20, 21, 22, 30, 31, 100, 200, 210, 220, 300 ā€¦ etc. We have tested the behavior internally and as per design folders are getting sorted by alphabetically with the below API. $sort attribute is used for sorting response.

/system/ws/v20/kb/folder

Could you advise if this is current API limitation or on any naming conventions or methods that would facilitate this type of sorting? They would like to sort folders in the order of 1, 2, 3, 4, 5, 10, 20, 21, 22, 30, 31, 100, 200, 210, 220, 300

Iā€™m not sure about sorting by a numerical value, but if you use a three- or four-digit number, you can sort alphabetically by the number. For example, 001 or 051, instead of 1 or 51. This would put the zeroes in front, which would make the number 003 come before the number 020.

1 Like