cancel
Showing results for 
Search instead for 
Did you mean: 

fileFolderService list sort natural numbers in name

leroux
Champ in-the-making
Champ in-the-making
Hi

My users are used to create folders with numbers in name in order to get a natural sort.
For ex :

|- 1 FOLDER1
|- 2 FOLDER2
|- 3 FOLDER3
|- 4 FOLDER4
|- 5 FOLDER5
|- 6 FOLDER6
|- 7 FOLDER7
|- 8 FOLDER8
|- 9 FOLDER9
|- 10 FOLDER10
|- 11 FOLDER11
|- 12 FOLDER12

They expects folders are displayed in this order but using fileFolderService.list like this


List<Pair<QName, Boolean>> sortProps = new ArrayList() {
         {
            add(new Pair<>(
                  GetChildrenCannedQuery.SORT_QNAME_NODE_IS_FOLDER, false));
            add(new Pair<>(ContentModel.PROP_NAME, true));
         }
      };

      PagingResults<FileInfo> results = fileFolderService.list(parent,
            !onlyFolders, true, null, sortProps, new PagingRequest(
                  skipCount, maxItems));


they get this result :

|- 1 FOLDER1
|- 10 FOLDER10
|- 11 FOLDER11
|- 12 FOLDER12
|- 2 FOLDER2
|- 3 FOLDER3
|- 4 FOLDER4
|- 5 FOLDER5
|- 6 FOLDER6
|- 7 FOLDER7
|- 8 FOLDER8
|- 9 FOLDER9


Is it possible to give fileFolderService.list any option to sort correctly numbers ?

Thanks
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

not to my knowledge. As long as users don't use 01, 02 … 10 for the leading numbers, this won't ever work. This is actually how our customers with similar "requirement" do it (like they also did in previous systems).

Regards
Axel

leroux
Champ in-the-making
Champ in-the-making
Hello,

One of my colleague has implemented a solution modifying GetChildrenCannedQuery class. It's much a workaround than a robust implementation but we don't have enought time to spend on it.

Implementation here :
https://github.com/Itldev/Koya/commit/379d2433037bb17dc7afeb71bb93d5026e5d2936#diff-ed5818d69e1abc48...

Regards
chris
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.