Upload new image or copy

I have an image column in my table, which works well to upload and then view pictures. However, to avoid users repeatedly taking a photo of the same ‘defect’ I have inserted a column of type ‘text’ with the option of selecting between ‘adding new photo’, ‘use the one from the previous record’, or ‘no photo’ [albeit in fewer words!!]. Adding this button is easy, and I can also conditionally show the image object only if the aforementioned selection = ‘Upload new photo’.
However, where I’m stuck is what my expression needs to be to cater for the 2nd option [copy from previous]. I added an if statement in the formula box for the image column, around retrieving the image path from the previous record if user selects ‘copy from previous record’, but I don’t know what my else statement needs to be to cater for the option of uploading a new photo, so my image object just disappeared off my screen. What to do …!
many thanks for any ideas of where I’m going wrong

Hi,

Not sure if i got you , and i am not really experienced.

The using existing pictures option, i suppose you wanna show up a list of available pictures.
To be able to choose a pic from a list, the type of the Column Images should be a Enum or Enum List.
Under Data Validity (Valid If) expression would be:

SELECT(TableName[Images],TRUE)

I am wondering if you would need to create a extra column to be able to choose the pictures and copy the value to the column Images.
Maybe it could be with an Virtual Column called [ListOfImages], and a expression for the Initial Value of column [Images]:

IF([Upload Image e.g. of defect]=“Use Previous”,[Images]=[ListOfImages],"")

Not sure if it helps

hey, thanks for the advice, and apologies if my description wasn’t clear. Essentially, when highlighting a defect I want the user to be able to choose to add a photo which is stored with that record, viewable by others. However, if the defect has already been identified/photographed then I’d rather they choose form the existing photos, rather than fill up my S3 storage.

I was looking at it too simply, trying to do with one or two objects/columns, so I changed that. Following your advice, my data model now includes the following 4 objects:

  1. User selection ‘Upload image’ ‘buttons’ [type: text, with list]
  2. ‘Images’ object for photo upload [type: image]
  3. Use ‘previous’ [type: enum, from the list of available photos referenced in the table]
  4. Chosen picture [if statement of the above two chosen based on the selection of the Upload Image button, as shown below]

item 1 is always shown, 2 and 3 are conditionally shown based on item 1, while item 4 is hidden [and item 4 represented the aggregated output, used elsewhere]

Many thanks
Diarmuid

1 Like

Further to my rather triumphant summary above, I have since realised that whilst this method works well in theory, it actually duplicates all photos, as each time a new picture is uploaded it is named by column reference in storage. Seeing as this is now straddling two columns [‘Images’, plus ‘chosen picture’] then the system saves it twice, once with each column name. Can I prevent this, and only upload the Chosen picture column item [i.e, inhibit upload for the Images column]?

Hi, i imagined also this :sweat_smile:
That is why i told you if you could make the column [Chosen Picture] as a Virtual Column.
Then make the input from this Virtual Colmn [Choosen Picture] to be copied to the Column [Images].
You could make this copy by setting an initial formula in the Column[Images]:

IF([Upload Image e.g. of defect]=“Use Previous”,[Images]=[Choosen Picture],"")

I didn’t try this solution, but you could give a trial.

You can try also writing a formula in the suggested values. I never used this field, maybe it helps also.

SELECT(TableName[Images],TRUE)

[Images] is where the new picture is selected. I don’t think I can add a formula to that without knocking out my photo taking option. I’ll rejig it and try again. thanks

Yeah i know, but you can force a value on it with an initial formula.
In the end the picture is just a text in the spreadsheet with the folderpath/picname.jpg or png.

I don’t think the initial value will help a lot, as the ‘problem’ [i.e. photo duplication] only arises when the user chooses to upload a new photo, so the [Images] column will have passed from initial value to selected photo value by the time it does anything.
Having the [Images] column as a photo selection input works well, as does the selection of the previous, plus the aggregation of these inputs to produce [ChosenImage], albeit with the duplication issue.
I tried to use a VirtualColumn for [Images] so a photo can be taken, in the hope that only the [ChosenImage] column image gets saved, but I cannot use a VC without an app formula, so I’m back to ‘real’ columns, and feel like I’m going round in circles …

Further ideas very welcome. Thanks a lot

Hi, my last trial on this !

Two tables:
Defects
Fotos

Defects[Foto] is a Ref from Fotos[FotoID] = must have same value.

On table Defects it looks like this
image

On table Fotos it looks like this

The Defects Form

When clicking on Foto, User can choose existing one or creating a new.
This happens thanks to Ref.

Make column [Foto] not required so if user doesn’t want, he won’t add a picture.
You won’t need column Yes, Choose Previous, No.
If you click in New , you will be redirected to the form of the table Fotos.

Hope it helps!

thanks a lot. I was actually unaware of this ‘ref’ option, so I’ve definitely learned something new here. I like that, and it works. thanks so much

1 Like