Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Jun 30, 2020 03:49 PM
(I’m pretty sure the answer to this question is going to be “that’s just the way it is”, but I’m gonna ask anyway.)
Is there a way to Group records on a field WITHOUT the Group also sorting on that field? I already have a sort I like (by Date) and a pretty “group header” field that spells out the month (e.g. “July 2020”) that I would like to group on so that the groups each show that field. However, when I Group on the field, it also sorts (alpha) on that field, screwing up the sort. Why isn’t Group just group? It should be named “Group and Sort” if it’s going to do both. :slightly_frowning_face: Or at least make the sorting an option that can be turned off.
Example:
If I have the following data:
1 A
2 A
3 C
4 C
5 A
6 B
6 B
That is, form a new group when the letter changes WITHOUT sorting on the letter itself.
3 C
4 C
Is this an unreasonable expectation? Is this something I can suggest as a feature somewhere?
(And why is my formatting all weird? :astonished: )
Jun 30, 2020 05:21 PM
Technically, it’s not sorting. It’s only grouping. Airtable’s group logic is this: find all records with the same data in the specified field and group them together. When that means rearranging record order, it does so, but it’s still technically not a sort because the records are simply being put into groups of like items. The order of records in each group is still arbitrary unless you’ve also applied a sort, in which case the sort comes after the group in the order of operations.
While the grouping logic that you described may be useful in your specific use case, it requires Airtable to store some sense of record order prior to grouping, which it does not. The only time that Airtable cares (sort of) about record order is when it has created that order itself via a sort. Aside from that, record order is not tracked internally.
Jul 01, 2020 02:52 PM
Why not group then sort by record ID, which will maintain natural entry order?
Jul 01, 2020 03:55 PM
Sorting by record ID will not maintain entry order. The characters that make up a record ID aren’t assigned in a predictable order. Take a look at the IDs of the default three records on any new table, and you’ll see three very different character sequences. The only way to truly maintain entry order is to sort by created time.
Jul 01, 2020 06:55 PM
I actually beg to differ here. The UI for Grouping clearly shows that it is going to “Group by NumberField from [ 1 -> 9 ] [ 9 -> 1 ]” or “Group by TextField from [ A -> Z ] [ Z -> A ]”, etc. You can’t not pick one of those options. If that’s not a sort, I’m not sure what is.
Thanks, though! :slightly_smiling_face:
Jul 02, 2020 08:51 AM
Sorry if I wasn’t clear. Yes, the groups are sorted, but there’s no sorting within each group unless you also have a sort created.