Attachment order

Is there a way to order attachments automatically by name?

1 Like

I don’t think there is any way to do this automatically in Airtable, but what you could potentially do is structure your database differently and interact with it differently:

You could store your attachments in another table called “Attachments”, with only one attachment per record. Give each record a text field called “Attachment Name” that represents the name of the Attachment. Then, you could sort this table alphabetically by “Attachment Name”, because each Attachment is its own record.

Back in your main table, you could still view the Attachments by linking to this new Attachments table and displaying the linked attachments in a lookup field. So back in your main table, the Attachments still wouldn’t be sorted by name, but at least you would have that possibility in the Attachments table.

1 Like

Thank you for this suggestion. I think this will not work for me. I have over one hundred lines of each over one hundred photos per line - so it would way to much…

Unfortunately, that’s not a great way to setup your database structure. Whenever you have “multiple of something”, you really want each one of those “things” to become its own individual record.

However, you could still easily do what I suggested above — and it would only take a little bit of extra effort on your end. You would just need to follow these simple steps:

  1. Use this tool to bulk export all of your attachments out of Airtable onto your computer:

  2. When using that tool to bulk export your attachments, it gives you the option to name your attachments based on a field. Choose your PRIMARY FIELD as the name for those attachments.

  3. Now that all of the attachments on your computer have been downloaded, create a new table in Airtable that will hold all of your attachments.

  4. Create a gallery view. A cool little hidden feature on the gallery view is that you can BULK IMPORT / BULK UPLOAD all of your attachments as brand new records into the table!

  5. So now that you have your gallery view, simply drag-and-drop all of your images (or any type of attachment) from your computer onto the big + sign that appears in the lower right-hand corner of gallery view. This + sign only exists in gallery view, and you simply drag-and-drop images on top of it. It will ask you if you want to create new records, and yes, that’s what you want to do.

  6. Your filenames from all the attachments will become the text in the primary field for each record, so you will be able to easily match these records back to your original table — but not quite yet. This is really the only tricky part. The text in the primary field for each one of your records has an extension after it, like .jpeg or .jpg. You need to strip these extensions from your field.

  7. If all of these files had the exact same extension (such as .jpg), then that’s pretty easy. You can just create a formula field with a simple formula like this:
    SUBSTITUTE(Name, ".jpg", "")
    If your file names are more complex you might have to create a different formula.

  8. So now, your formula field should contain text that IDENTICALLY matches the names of your records in your original table. All you need to do is change this formula field to a “link to another record” field, and link it to your original table.

  9. And that’s it! :slight_smile: Now all of your attachment records are in their own attachments table, and all of your attachments are linked to their original records back in your original table. Back in your original table, you will also be able to add a lookup field which shows you all the related attachments for each record.

Unfortunately, the Bulk Update block does not support sorting attachments, although it does support sorting for other fields, such as multi-selects, linked records, and collaborators.

However, this could be done with a custom script for Scripting block.

Well, he should ideally be getting those attachments out of their individual cells anyways. With hundreds of attachments per record, they really need to be in their own table. The 9 easy steps I outlined above will enable him to easily do that, and then he’ll have a nicely-structured database from that point forward.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.