Sort items at each index numerically?

Hi All, I have a list where the indexes each contain a string of numbers separated by commas. I cant find a way to organize this in a way I want.

As an example, I’ll have something like:
(1): 22,10,37
(2):1, 17, 12, etc.

Is there a way to get the results as:
10,22,37 without changing the index?

I feel like there is an obvious solution to this that I’m just missing. . .

Edit: Small image of item in list:
image

Hi @GJax89 - Have you tried using List.Sort? It should naturally work :slight_smile:

1 Like

so great and so many ways :wink:

1 Like

I did give that a shot, but my issue is its not a list of lists, its a list of strings. So my full index is:
1,2,3

not:
1
2
3

I don’t know if that changes anything, but list.sort wasn’t getting me where I wanted to be.

I have not tried sort by key, but again this is showing data in a way I don’t have the data. Apologies if my stated example was unclear. Ill try and add some images to the example.

Can you please post a screenshot of what data you are using :slight_smile: ? Easier to solve that way!

Does this work :smiley: ?

1 Like

If you could flatten the output from code block to a single index that would be what I’m working with for the input

You need to convert your strings to lists. You can’t sort a single object.

Make sure you’re using natural sort or else your numbers will be off. GeniusLoci has one and I think Orchid has one as well.

5 Likes

aaha thats the question…nice spot Nick :wink:

1 Like

Thank you Nick! this is exactly what I was looking for. I knew there was a solution I was just to thick to see it!

@solamour and @sovitek thank you both for trying, I think I just wasn’t explaining what I was trying to do properly.

1 Like

All good… glad you got the answer you needed in the end! :smiley:

2 Likes