Issue with the Sorting pages having numbers in name and title | Community
Skip to main content
Level 2
June 30, 2017
Solved

Issue with the Sorting pages having numbers in name and title

  • June 30, 2017
  • 2 replies
  • 996 views

Hello,

  I am this specific requirement where pages are created as 1, 3,5,2,1A,4,2B...10,11,12 etc. I am having difficulty while fetch the pages and it comes up as 1,10,11,1A,12,2.... and that is not desired. I can not use listChildren method as it would give me the pages in the order they are created. I tried using query but if I say order by title/nodename then I get into the same issue as query treats the numbers as string.

My desired results are like 1,1A,2,2B,3,4,5...10,11

Any suggestions on how I can do the sorting effectively? Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

Have you tried to create a custom Java method in a service that would have a custom sorting algorithm:

algorithm - sorting integers in order lowest to highest java - Stack Overflow 

2 replies

smacdonald2008
smacdonald2008Accepted solution
Level 10
June 30, 2017

Have you tried to create a custom Java method in a service that would have a custom sorting algorithm:

algorithm - sorting integers in order lowest to highest java - Stack Overflow 

VeenaVikraman
Community Advisor
Community Advisor
June 30, 2017

I agree with scott. The best workaround is to write a custom algorithm to fetch all the pages , get the titles and sort it in the way you want