I have not seen any tools for sorting tables (lists of lists) ascending and descending by columns other than column 1, so here is a blocks library and a way to specify the sort order.
This only sorts by a single column at a time, and uses no extensions or Web View components.
The sort is via value procedure, so the output of one sort can be fed directly into another sort or one of the many table view techniques available on this board.
This also works on one dimensional lists.
Ascending Sort order specifications can be:
- empty text
- a positive column number (for sorting tables)
Descending sort order specifications can be:
- a negative column number (-2 = sort by column 2, descending)
- anything else that doesn't match anything above (desc, descending, -, etc.)
Sample calls, in increasing complexity order:
(Note how upper and lower case of the same letter are brought together in the sort, and numbers sort separately and numerically)
Example of sorting by column 2. Notice how unfortunately, I have not yet figured out how to maintain the order of equal valued items. Good thing this is open source, huh?
Sorting by column 2 in descending order.
merge_sort_customizable.aia (7.8 KB)
Please note that I did not include any display component. This is strictly a back end blocks library.