Another way to sort group name and item name inside a collection

Edit:
My bubble has been burst by @Atom :rofl: Thanks for the link:

Context:

I discovered a new method for sorting elements within groups and sorting the groups themselves:

  1. Create a Template Column: Combine the columns you want to sort by into a single template. For example:
    GroupName (a number if you want to control the order of groups) - ItemName.
  2. Use the Template Column for Sorting: Apply the template column in the “Sort Group By” option of your collection.

This approach simplifies managing both the group order and the order of elements within each group.




1 Like

My bubble has been burst by @Atom :rofl: Thanks for the link:

Yeah, I’ve done this a few times. Just need to be careful if using numbers in your template because numbers will be sorted as text instead of numerically (ex. 10 comes before 9 because 1 is smaller than 9 alphabetically, whereas 09 and 10 would sort correctly). When using numbers, which are converted to text, you need to zero pad them so they are all the same length, so they will sort correctly.

The other thing to watch out for is to make sure the character used as your delimiter comes after any other character in Unicode order. Otherwise it may sort incorrectly. I think a dash (-) is fine but I’ve never taken the time to look over the Unicode ordering of characters to figure out which is best.

In most cases it should work fine, but those are a couple of things to look out for.

1 Like

Good catch!

1 Like

I usually just convert them all to a single number, and structure my math around which column should be prioritized for sorting.

2 Likes

Same :+1:

2 Likes

If you consistently use the same character combination, such as " - ", for every element, it should work fine.

1 Like