File column showing cached PDF, not linking to actual file

Hey everyone. I’m having a problem with a File column always showing an older version of a PDF (said PDF is created and updated via a workflow in the app).

  • I’ve got a workflow that creates a PDF (for an invoice) and saves it in a folder in the Gdrive associated with the app.
  • I’ve got an action that then writes the file path/name to a file column for the invoice record.

This gives me a column that I can click on to open the saved file… and all this works.

Until I make a change to the PDF; then I don’t see the newly updated file, instead I continue to see the version of the file that I opened immediately after it was created.

For example: say I trigger the workflow to create the invoice file and write the file path to the File column: after the sync cycle for creating the PDF is complete, I can click on the File column to view the file - and it works. Then if I make a modification (say some rewording of a line item or something) and re-trigger the workflow (which updates the PDF), when I tap the File column to view the file I still see the first version - but if I go and check the file in the cloud it indeed has been updated.


It’s like the system is caching a version of the file and showing me this, instead of pulling the file from the cloud when I click on it.

  • I’ve checked the the actual file in the cloud IS updated
  • I’ve confirmed the file name and path is correct (it wouldn’t open anything otherwise)
  • I’ve synced the app a bunch of times already (a dozen as of this writing).
  • I opened the app in a web browser (after clearing cache), thinking this would cause the browser to re-download the file

It has been about a 1/2 hour since I’ve made the last update to the file, and I’ve tried all of the above again to no success. (I was thinking maybe it was a time based thing: you know, we only check the file to see if it’s been updated every 30 min or something…)


I would just use a “GetAppFileURL” and make it work that way - but things are changing and that won’t work for very long.

@Phil any help would be appreciated. :nerd_face:

1 Like

If you are reusing the image file URL and directly updating the contents of the image file, you will only see the updated image value once the cached image ages out of the Cloudflair cache.

If you enable “Secure Image Access” we do not cache the image in Cloudflair and image retrieval performance will suffer. You can enable “Secure Image Access” by going to Security > Options in the Editor.

I’ve always been under the impression that the cache time is huge, to the point that reusing a file name for downloadable content or images is discouraged.

The quoted text is about images, does that apply to PDFs as well?

And does this all mean that “eventually” the newest version will be shown?

Hello @MultiTech_Visions!

I’ve had a similar issue. Seems that it was solved by an workaround: using a sequence of actions. First erase the collumn value for this row then recreates.

But still there is a catch: do not try to open it before the app finish creating the PDF file.

1 Like

Your guess is as good as mine… :frowning:

That… sounds like a true work around. :laughing::nerd_face:
But it makes sense in a way; you clear it, then we put a value there that could be anything (even though it’s the same one) - but this would cause the system to re-ping the cloud for the file.

:+1:

I know this is an old thread, but just pasting this here as reference.

1 Like

Still getting the old pdf file…

There is effectively no way to update a PDF or other file made available through you app. If you have a new version of the file to distribute through the app, it must be given a different name. Replacing an existing file with a new file of the same name will not work.

1 Like

Just to clarify a point in what you said:

You CAN update files via the app, it’s just that the changes won’t be shown in the file you get from the app immediately - you have to wait for the cached version to update. But if you migrate the the actual folder where the files are saved, you’ll see they’re indeed updating.


To update an existing PDF file, simply call the original file creation process again - AppSheet it smart enough to know that it needs to update the file and does so - it’s just that the file “served” by the app is a cached version, so you’ll have to wait 24 hrs or something.

2 Likes

Even if you call the action that created the PDF, if the filename will be the same, then Appsheet will still show the cached version. Steve is correct, you have to change the file name.

The only other possible alternative is to turn off the Store content for offline use in the Offline Sync tab of the Behavior page. Which is not ideal if the app is set to run when offline.

2 Likes

I just wanted to clarify the implications being made here: you do not have to constantly change the name of a file to update it…

  • You only have to do that if you want to see the newly updated file in the app within 24 hrs.

It seemed to me that someone could make the conclusion that in order to update a file you’d have change the filename 100% of the time in order to get the file to update. (i.e. the first filename would be “Invoice_224_1”, then a second would be “Invoice_224_2” and the third “Invoice_224_3”, etc. etc. - and if you didn’t make these changes the file wouldn’t update.)

  • That’s not so. The file updates, it’s just not shown right away.

The following scenario happens every time I make an invoice in my time-tracker (TT iota):

  1. I enter the record level details that will populate the template
  2. I generate the file (which is saved in my Gdrive, and a file reference is pushed into the existing invoice record)
    • This original file has the status at the top of “Building” - actually inside the generated PDF
  3. I confirm that the invoice PDF is as it should be, finalize the record in the system, which re-generates the invoice again
    • Instead of generating a new file, AppSheet updates the existing file.
  4. When I view the file, after it’s done re-generating, I still see the “Building” version
    • If I go to Gdrive and find the file, I see that it’s been updated to “Due” at the top.
    • the attachment in the email sent out to the client uses the “updated” file - not the cached version
    • if I come back to the record 24hrs later, the “Due” invoice is shown.

I just checked to see what file would be served up by the app for an invoice file that was generated over 24 hrs ago, and AppSheet showed me the updated file.

  • This means that over time, the cached version is replaced with the “new” file.
    • But to get the “new” file to show right away you’ll need to change the file name, as @Steve says
2 Likes

Yes. That’s what we are all talking about here already - To show the new version right away.

I assumed that I didn’t have to repeat it in my last reply.

Any solution to see the updated file right away or we have to still wait for 24 hours?

Not sure this tip will help you out, but this is one of the workaround I believe.

1 Like