Hi Community,

Imagine a Table with a column called “order” with rows like:

1

1.1

1.1.1

1.2.1

2.1.1.1.1

…

depending on the context, some rows might have more dots than others.

Does any one know a clever way to sort it without building tons of helper columns?

Thanks in advance.

For sure!

Heres an easy way to do it using `Regex`

Regex can be an intimidating formula, but is honestly one of the most useful Coda formulas you can have in your toolbelt. Heres some thorough documentation on how to use the different Coda Regex formulas!

Thanks for the answer Scott.

I think I was not very clear. I actually want to sort rows by the hierarchy of the version. This means, for example, that a row version 2.2.2 would be higher than 2.1.1.1.1, because the hierarchy is left to right.

In your example, if I use the results to sort the rows, it would put 2.1.1.1.1 in a higher position than 2.2.2, which is not what I intend to do.

Aahhhh

So it would be

1.2

1.1

2.3

2.2

2.1

3.1

Correct?

I think what @Felipe_Griebel means is that using your method would result in numbers still out of order.

For example 2.2.2 becomes 222 and 2.1.1.1.1 becomes 21,111.

Number order would still be the way to go. I think the best solution would be adding zero’s so that they are all 5 to 6 digits.

Then the sort would be

10000

11000

11100

12100

12400

13100

21111

22200

Hope that makes sense.

Dale

I have found a solution!

Thank you for your time.

What Dale described is knows as zero-padding sort and is a common practice among back-end developers. I am not a dev, so I was having a bit of trouble implementing it in Coda tables, but now I did it.

My main purpose was to organize parent-child like structures so the views would have a coherent visual output.

like this from → to

Or this from → to

Here is the shared solution

Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.