_merge() formula not returning the image object

What’s wrong with _merge()
I’m trying to use @Paul_Danyliuk formula to get image URL. When I add a picture to an empty image column, _merge() doesn’t return an object. I have to edit the formula, e.g, adding a blank space, so that the formula is updated.
I created a video to show the issue
merge

There’s just a bug with it to my knowledge. Merge() is a hidden formula so you gotta take what you can get

That’s why I made the ImageURL pack, it has a button action that I use in automations that watches for row changes in the image column, then outputs the url using a modifyRow() action

The only other way I’ve found is to rewrite the formula every time you want a new images url.

1 Like

Just in case :innocent: , but I use:

ParseJSON( thisRow.[Image(s)/Video(s)]._merge() + "", "$.publicUrl")

and not just :

ParseJSON( thisRow.[Image(s)/Video(s)]._merge(), "$.publicUrl")

See the missing + "" after the ._merge()

This, AFAIK, has always been the complete trick from @Paul_Danyliuk :blush:

2 Likes

yep and you can replace the + " " with ToText() to have a coherent Coda friendly syntax.

It’s not about the merge or whatever. It’s about the fact that finishing an upload (plus virus scan etc) doesn’t trigger any formula recalculation.

One crude hack is to make the formula dependent on Now(), i.e. make it like

ParseJSON(thisRow.[Image(s)/Video(s)]._merge() + "", "$.publicUrl").WithName(I,
  If(Now(), I, I)
)

But that will result in the formula getting ‘recalculated’ every second, wasting computer resources and making Greta Thunberg sad.

Another option is making a button that you have to explicitly click after uploading a file, and set it up to keep rechecking in a 2-button while loop until the URL is there.

2 Likes

Haha

Best way probably still the automation on row-change using my packs button action

But - I have found that at points the virus scan (whose completion must be complete to output a codahosted url) can sometimes take very long.

Their virus scanner is dependent on a third party, so Coda and us don’t really have any control over how long it takes for your image to actually be uploaded to their servers.

Therefore if the virus scan takes LONGER than it takes for the automation to trigger, you may be out of luck.

Though this is all theoretical - as for now, the automation works for most cases as the virus scan is complete prior to the automation triggering.

In one client doc where their workflow is dependent on these URLs and we can’t leave the virus scan time up to chance, I trigger hour based automations to pull out the hosted urls.

1 Like

Running an automation is certainly a way. No pack needed though.

You can have an automation that triggers on image column change. The automation will then try to read the image’s publicUrl and insert it into the URL column.

If the URL is still blank, you update a different column, e.g. with a timestamp value. Then you have the same automation listening on that other column doing the same thing.

This way if the URL is found → the URL is set, automation stops.
If the URL is not found → another automation is triggered, and it keeps getting triggered until the URL is found.

2 Likes

Hi, @Paul_Danyliuk
Wasn’t it supposed to trigger a recalculation when I delete and then upload a new file? It has to trigger a new virus scan anyway. The funny thing is, if a change the order, instead of deleting the image first, I upload a new image and then I delete the old one, it gets recalculated. Isn’t it an odd behavior? I created a animated gif bellow
teste2

I guess I didn’t say it right.

Any changes to the upload field (adding a file, removing a file etc) → triggers a recalculation of the URL column.

The moment when the file stops being “in progress” and becomes “uploaded” (and gets an URL assigned) → DOESN’T trigger the recalculation.

Your URL column gets recalculated immediately when you upload your first image. It’s just that publicUrl at that moment is still blank because the file hasn’t uploaded yet (i.e. URL hasn’t been made for it yet; the image hasn’t yet been checked and hosted). It just never gets non-blank after the file gets its URL. Then the next time you twitch the upload cell, the formula recalculates and shows the publicUrl that has been there for a while now.

4 Likes

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