Convert an image to XY

Hi, I’m trying to build an app that the user can add an image and use this image for XY display.
I tried 2 methods but none of them work perfectly.

  1. [image] - insert an image in “FORM” view
    [Link] - {app formula: CONCATENATE(“https://www.appsheet.com/template/gettablefileurl?appName=",“Thisapp-34005-19-09-08”,"&tableName=”, “facilities”,"&fileName=",[image]) }

In the spreadsheet I got very long link that leads to error.

  1. I have created a Virtual column in order to invoke the [image] text, but the result was the same…

any advise how to do that within in app formulas

I hope I made my self clear (sorry for my English…)

thanks in advance Appsheet community

IF you are trying to do this at the same time when you are filling the photo on a form view because the image is not yet saved to your database. It will only work if you first save the record and then reopen it.

1 Like

I found a solution. Please correct me if I’m wrong.

In the XY Column you can use the “Background image for the XY coordinates” expression:

CONCATENATE(
    "https://www.appsheet.com/template/gettablefileurl?appName=My_App-12345&tableName=My_Table&fileName="
    , [Ref_Column].[Image_Column])

This would produce a link that will not work:
https://www.appsheet.com/template/gettablefileurl?appName=My_App-12345&tableName=My_Table&fileName=My_Table::My_Table_Images/0afb8fcb.Image_Column.091309.jpg

But if you use this expression, it corrects the link by deleting the “My_Table::” Part.

CONCATENATE(
"https://www.appsheet.com/template/gettablefileurl?appName=My_App-12345&tableName=My_Table&fileName="
, ENCODEURL(RIGHT(TEXT([Ref_Column].[Image_Column]),LEN(TEXT([Ref_Column].[Image_Column]))-8)))

I don’t know how stable this is, but at least you don’t need an extra Column with a Google Sheet Formula as described here under “Showing Images in Google Sheets”.
(I’m working with Database, so I cannot use the Google Sheet Solution)

7 Likes

Update: I’m using this solution since then, and it seems to be quite stable.

1 Like

Is there another way to do that?

Seems that the image links are no longer the “https://www.appsheet.com/template/gettablefileurl? […]” it used to be.

Hi @hcquadros @Aleksi @Fabian
I notice images have dissapeared from some sample apps. Could this be related?

Thanks, man! This solved my issues!
I can now use a select-formula to choose between the drawings connected to the chosen project, and then pin the deviation to that drawing (background image in YX). I was struggeling with the issue that formulas (links) was changing the URL-name to the image(drawing). Then it woulden convert to a valid background image in YX. But you solved it, man.
No need to convert image files from Google drive. No need to save and reopen. Gets the image in a flash in Form-modus.
Works great now! Keep it up, I read a lot;)

2 Likes

Hi Kristofer,
glad to hear that it helped you :slight_smile:
Is the image URL a publik URL? I mean, can you open the image URL outside your account?

Hi Fabian.
My link is to Google drive, so its a dynamic URL. I set it to “those with link can view”. Those with link can open that in a web browser, but then it is through google. This dynamic URL doesn’t work in APPSHEET as you know.
But to generate a static URL I used your solutio: CONCATENATE(“https://www.appsheet.com/template/gettablefileurl?appName=Kon-troll-1084716&tableName=KS_rapport&fileName=”,ENCODEURL(RIGHT(TEXT( [Ref_tegn]),LEN(TEXT([Ref_tegn]))-11))) My table name is “tegninger”. I had to add 2 nuber of charachers since it’s adding “::” to the table name. So 9+2=11 (in the end of the expression).

Awesome, very good.
Can you please check if this static URL is public? I think so. But I’m wondering if this could bring us trouble, when working with sensitive data?

Hi. Checked it out now.
First I converted a link that was public in to static URL using http://kolorobot.github.io/permalink/
I could access in “Incognito modus” (not logged on).
Then I tried the same with a link to a file NOT public, and got no access. Google asked me to log on.
So it seems quite secure:)

Sorry I mean the Image you get from this expression. Is this public?

Sorry.
Yes you are right. Even links to files NOT set as “public” will after the expression turn into links public for everyone in a browser.
Had to make a “dummy field” to se the name of the new url an then test it with a file not sheared. But it was still viseble when pasted in a incognito browser.
Good to know, but how can this be misused?

Hi.
Does this still work for you?
After an update at APPSHEET yesterday, all my APPs with this solution stopped showing the background image in XY…
Same issue for you?

Just an update here: After Appsheet update 13th of April, it is no longer needed to convert the image from Google drive. It works perfect directly as a background image.
Well done!

5 Likes