Identifying 404 image Error

Hi Everyone!

I have a an app which pulls images from Google drive using a virtual column. Each filename of the image is a number, so it's simple to have  avirtual column of:

"Image Folder/"&[RecordID]&".jpg"

Not all of the records have an image, in which case the app displays a small warning triangle icon, which is fine.

My challenge is to identify which records don't have an image, kind of like an "IFERROR()" function.

Is there any way to do this?

 

1 12 467
12 REPLIES 12

Steve
Platinum 4
Platinum 4

There is no easy way to do this.

This would be tricky possible. Try,

1. Create a new table in Google Sheet.

2. Use script to list file URLs in the image folder. Check out here .

3. Set schedule for the script to run automatically such as hourly (depends on how often the images are saved).

4. Add the new table in AppSheet, and then modify your expression like

IF(IN( "https://...???..."&[RecordID]&".jpg", imageListTable[Url]),
   "Image Folder/"&[RecordID]&".jpg",
   "...a static URL for thumbnail displaying like no image found...")

5. Cross your fingers.

Thanks @Steve ! If there's no easy way, I'll take a hard way ๐Ÿ˜.

 

@Swoopy that's a great idea. I was actually thinking along similar lines, but a simpler implementation.  I can add the Drive folder where all of the pictures are stored to AppSheet as a new table with "Folder as Data Source", and that will automatically give me a table of file URLs, with out the App Script.  Then use an expression like:

IF(IN("Image Folder/"&[RecordID]&".jpg",Pictures[File]),"Image Folder/"&[RecordID]&".jpg","Default URL for Error")

That would let me substitute a default picture, and what I'm really trying to do is make a slice of only records that have pictures.

 

My concern with this is that adding a new folder as a table, with hundreds of images in it, will slow down the sync times of the app signifigantly. @Swoopy 's idea would probably not have this problem, since t's not loading the pictures, just the URL.

I'm intimidated by AppScript, because I don't know JavaScript well enough to understand what it's doing, but maybe I'll give it a try.

First thing to mention is your app does not download all images to device's memory. Only related images required to be displaying on seen screen are downloaded to memory. This's known as "lazy download". App would not slow down by images.

An easiest way (if the images are optionally added/edited/deleted by users) is using workflow/bot to auto-fill physical image-url-column with "Default URL for Error" when users save form without image. You need a physical column to make this happend.

How to see what files exist:

Compile folder contents - AppSheet Help

Thanks Steve.

I'm aware but curious of using the compile folder contents. I don't know is the updating of this document table done on AppSheet server or on device, and how often is it updated, every sync or ? (this's why I proposed GS approach)

Could you give more technical details?

I've been using Folder as Table for other things, which is what gave me the idea.

In my experience it updates the table on every sync, just like a Google Sheets table.

If that's really the case then it would impact app's performance in waiting the drive content polling. I like having GS do jobs for me in background.

That's what I was afraid of. I'll make a security filter on the table to only load the pictures whose number appears in the Data table, which might help.

 

It's waiting the drive polling anyway. Using physical image url column + workflow/bot does not impact performance.

Hi @Swoopy !

Unfortunately, that doesn't work in this use case. It's complicated to explain, but the pictures I'm using are "borrowed" from a different database, hence they are already linked with RecordID numbers.

So the pictures aren't being added by the user from an appsheet form, but imported from a csv originating in a different database.

I've network apps using image-pool stored in company's web server because we believe it's more reliable, easier to manage with dedicated software and of course much faster download. Users are not allowed to save any images because of standardized image quality control reason. The apps have a view showing which items in catalogue still don't have images but they are avilable in stock so when users see them they send sample image to admin to refine and update on the web server. Otherwise the catalogue items just show no images. We don't bother doing anything cosmetic to them (try to make apps as lean as possible).

Top Labels in this Space