Create a Table Sort Canvas Control

There are times when sharing a doc, or just for your own simple use, it’s helpful to have a canvas control to quickly sort a table. The table controls for sorting don’t have a formula builder, so another strategy is required to make this a possibility.

Here are two examples, one that lets you choose the column to sort by and the other that lets you choose the column and direction.

The strategy here is to create a column that really just copies the column data for whatever column is chosen in the control. Then setting this column as the one to sort by for the table.

The second example takes this a step further and creates a sort number based on the rows position after being sorted by ascending or descending.

6 Likes

That’s great! I’m actually going to add it to one of my docs right now :star_struck:

1 Like

Thank you for this elegant trick @BenLee. It also helps me to understand the SwitchIf formula, as I am not a proficient Excel nor Coda user, yet! :laughing:

Curious to find out how this impacts performance on larger tables using the debug calculations option, as I have a few with lookup columns using data from both its own table and others, needing recalculation with each change or new entry. The article about Improving performance helped me a lot already…

Thanks again for sharing!

I’d imagine this will be somewhat of a hit to performance for a large table, but I’m not sure to what extent. It’s not necessarily recalculating formulas, just writing the column value there, so it’s tough to say.

The sort column option shouldn’t be too bad, but the sort direction may be more of a hit because it’s running a filter on the whole table for each row’s value.

I think I came up with a trick how to avoid the Find() to support the ascending/descending toggle.

And the trick is to… use two columns and keep one or the other blank :grin:

Updated the sample:

My original topic: Sort / group table with external controls

3 Likes