Forum Discussion
zalik22
Sep 19, 2023Copper Contributor
Help with sorting Sharepoint List
Hi, I have a sharepoint list that contains a combination of alpha and/or numeric characters. I am trying to sort descending by the numeric portion of the field. Any ideas? Some example values are: AB...
SvenSieverding
Sep 20, 2023Bronze Contributor
Hi zalik22
you could create a new numeric column "SortColumn" and sort by that. Then use a PowerAutomate Flow to set values for the "SortColumn" like this (Assuming your original values are in the "Title" column):
Use the formula
int(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(toUpper(triggerOutputs()?['body/Title']),'A',''),'B',','),'C',''),'D',''),'E',''),'F',''),'G',''),'H',''),'I',''),'J',''),'K',''),'L',''),'M',''),'N',''),'O',''),'P',''),'Q',''),'R',''),'S',''),'T',''),'U',''),'V',''),'W',''),'X',''),'Y',''),'Z',''),',',''),' ',''))for the SortColumns.
Best Regards,
Sven
PS:
I could not get this calculation to work with a calculated column, which would be much better.
But replacing multiple instances of a string in another string is not that easy..... If your string would have a pattern like "<Character><Character><Character><Number>" then we could try to develop a formula that just strips the first three characters from the string or something like that.