Skip to main content

I have a table where there are potentially multiple images available:

  • Two columns linking to other records, then
  • One Lookup column for each of those to look up the image attachment, and then finally,
  • One more column where I paste a screenshot, used for cases where neither of the other links are present.

So there are potentially 3 columns which could contain an image attachment.

 

If I were to try to build a sensible gallery or an app, I’d only want one image for many of the views, so I’d like to make a Best Image column.

The rules are more or less:

  • Does Source 1 exist?
    • If so, use Source 1
    • If not, does Source 2 exist?
      • If so, use Source 2
      • If not, use Screenshot

 

If I try to do this using a Formula column, I end up with what looks like a URL to the image on dl.airtable.com, instead of it displaying the image. The docs do say that attachments can’t be returned from formulae. The thing it does return may be usable for a webapp still; I haven’t yet tried. At the very least, it isn’t viewable directly in Airtable.

 

Of course, I could just go through and manually copy-paste the best image from one column to another, and set up some kind of workflow to try and prevent me forgetting to do this after adding new records. I would prefer to automate the process though.

 

So, is there some other way to do this?

 

Hey ​@Hakanai!

Rather than using a formula this could probably be achieved by setting up an automation with some conditional logic.

E.g. 
Trigger: When a checkbox is clicked (when a record matches conditions).
Branch A: IF Source 1 is not empty, then:
Get attachment from Source 1 and push it (update record) to Final Attachment field
Branch B: If Source 1 is empty, and Source 2 is not empty, then:
Get attachment from Source 2 and push it (update record) to Final Attachment field
Branch C: If Source 1 and Source 2 are empty, and Screenshot is not empty, get attachment from Attachment field and push it (update record) to Final Attachment field.

You can read more on conditional logic for automations here.

Mike, Consultant @ Automatic Nation


re:  The thing it does return may be usable for a webapp still; I haven’t yet tried

Nah that won’t work I’m afraid; Airtable stopped this from working awhile ago with their update for expiring attachment URLs (https://support.airtable.com/docs/airtable-attachment-url-behavior) as they don’t want to be used as a filehost

---

Automation like Mike mentioned’s probably your best bet.  If you’re coding your app I think I’d create a formula field to output the field to use and then put the logic in the code to pick the right field instead though; seems simpler to me but this is pretty subjective


Reply