Mar 18, 2020 09:04 AM
I have two tables in my database. One is the primary, the other is linked on one field to the primary. The entries that automatically appear in the linked table field are alphabetical, as that is the nature of the key in the primary. However, these entries are not in alphabetical order, but in order of entry/linking from the primary table.
Is there any way I can sort that one field in the linked table so it lists the records alphabetically, A-Z?
Mar 18, 2020 09:24 AM
In general, linked fields are displayed according to the order that they are stored internally. However, depending on how you access the linked records (directly in the linked record or via a formula), sometimes the records are displayed first-to-last and at other times they are displayed last-to-first.
You can manually change the order of linked records after they are already linked, but that is a huge pain.
It is also possible to change the order of linked records in a script using scripting block.
Mar 18, 2020 09:48 AM
That’s pretty much what I thought ;-). Can you direct me to where I can find instructions on building a script/scripting block?
Thank you.
Mar 18, 2020 10:26 AM
The support page for Scripting block has a lot of information.
You can also look at my script for finding the first/last linked record for help.
You also need to know JavaScript to write a script.
Mar 18, 2020 10:37 AM
Great — thanks kuovonne
Mar 18, 2020 11:47 AM
You can also use the Batch Update block if you have a Pro subscription. (Sorry I forgot about it before. I’ve been working with Scripting block a lot recently, and my thoughts tend to automatically go there first.)
Mar 19, 2020 08:49 PM
It looks like this inconsistent behavior is about to become more consistent. There is now a new toggle option for the order of linked records. This option will exist for bases created before April 2020 (basically all bases currently in existence) as part of a migration to the new, more consistent display.
(The order of record links will still be based on the order in which the links are stored, not in order of a field value.)
Mar 20, 2020 08:24 AM
Awesome improvement! Thanks for letting me know – I hadn’t gotten around to scripting yet, and now won’t need to.
Mar 20, 2020 09:36 AM
While it is a good improvement, it won’t actually help you get an alphabetical sort.
Your best bet is still the Batch Update block, unless you are on a free plan and feel comfortable writing a script (or hiring someone to write a script).
Mar 20, 2020 10:03 AM
It does give me an alphabetical sort on the linked field — but only on my desktop. The toggle option is not available, apparently, in the mobile app.