Forum Discussion

Nikki-C's avatar
Nikki-C
Copper Contributor
Apr 20, 2020

Sorting Alpha-Numeric String Fields Numerically?

Hi,

In Sharepoint my file names are string types that contain both letters and numbers. How do I get the files to sort numerically (i.e. 1, 5, 13, 20) as opposed to sorting it like text (i.e. 1, 13, 20, 5)?

 

There are many many files. I'm aware that keeping all numbers the same length avoids this issue (i.e. 001, 005, 013, 020) but would like to avoid going back and changing these one by one.

 

Is there some sort of JSON code you can write in the custom formatting section? Any help is appreciated. I am completely unfamiliar with JSON.

    • SvenSieverding's avatar
      SvenSieverding
      Bronze Contributor
      You could create a new number column "SortOrder" and a Flow that sets the value of the "SortOrder" column to the number part of your filename...
      Then sort by that column
      • LTJ88's avatar
        LTJ88
        Copper Contributor

        SvenSieverding Thank you. this solution was brought forth several times but in document control most of the time the unique document code will be put in file name as well and this is how we sometimes deliver the set of document packages. I'm looking for solution that require less work on my side since the correct sorting is already there on the file name.

Resources