Click link to download file if url is not set beforehand

Hi all,

I have a list of names as links in a repeating panel.

When I click on a name, I trigger a call to an external API that pulls data associated with that name. I create a media object at that point, but how do I trigger a download of the media after the link has been clicked.

I ask because the link’s url is not set beforehand (but rather the data for that name is pulled as needed).

Perhaps I am missing something obvious here. Any help is appreciated.

Al

We’ve added a download function, so you can run this in a Form to trigger the browser to download a Media object:

download(my_media_obect)

Here’s an app that does that:

https://anvil.works/build#clone:4IMIYKI4QVGG3VEN=FLHJKXIOGXLL7WLLAFQWGDAR

1 Like

@shaun This is amazing.

This also bypasses the issue here:

and solves:

1 Like