Survey123 Tricks of the Trade: Set the file name of photos and signatures

6748
11
12-04-2022 08:59 PM
IsmaelChivite
Esri Notable Contributor
4 11 6,748

 

Do you want to control the exact naming of image files submitted through a Survey123 form? It is possible! Using an XLSForm expression, you can set meaningful file names to photos and signatures collected via the Survey123 web and field apps.

The concept

 

Look at the screenshot below. Note how the file name of the photo has been automatically set to combine previously entered information: The Job ID and Service Type.

IsmaelChivite_0-1664399781803.png

You can set the file name of photos, but also signatures. For example, in a Building Permit Application form you may want to compose the file name of a signature using the full name of the requestor plus the exact date and time when the application is submitted.

Having full control over the file names uploaded into ArcGIS is particularly beneficial when you plan to download your data, including attachments, in the future. 

The XLSForm basics

 

To control the name of the files you upload from Survey123 into ArcGIS, you need to use the fileName parameter in the bind::esri:parameters column, as shown below.

IsmaelChivite_1-1664402973229.png

Here are some examples:

The name of a photo combines the job ID, type and the current time.

IsmaelChivite_2-1664407995941.png

The name given to the signature image file combines the inspector full name with the current time.

IsmaelChivite_1-1664407769082.png

Rules and tips

 

Here are some rules to properly set the file name:

  • Avoid spaces and the following special characters: \ / : * ? < > ; | . , ".
  • The file name must be unique: Otherwise, you will have trouble either attempting to upload, or when you download the file in the future.  
  • Keep file names under 140 characters

If you do not follow the rules above, the Survey123 mobile and web apps will override your file name with one that complies with the rules.

Tips:

  • Always use a time stamp as a suffix to make your file names unique. For example:

fileName=concat("Photo_",format_date(now(),"%y%m%d%H%M%S"))

  • Using a time stamp as a suffix, does not guarantee uniqueness if you have multiple image questions. If your survey includes multiple image questions, add the question name as a prefix to avoid the possibility of duplicates. 

IsmaelChivite_1-1670214567732.png

  • If you want users to upload more than one photo using a single image question in your form, use the multiline appearance. More details here.  When using the multiline appearance, the time stamp suffix alone will make every file name unique.
  • If you want to extract and store the file name into a separate field, use a calculation 

IsmaelChivite_0-1670214216394.png

  • On supported in the mobile app: If you want to show or hide the file name to end users, use the fileNameVisible parameter. Similarly, the allowRename parameter is used to control if the file name is shown as read-only or not. You can combine fileNameVisible. allowRename and fileName properties by adding a space between them:

fileName=concat("Student_Photo_", $(first_name},"_",${last_name}) fileNameVisible=false

fileName=concat("Student_", $(fullname}) fileNameVisible=true allowRename=false

Read the Customize file names  section of this help topic  to learn more.

 

11 Comments
LiamHarrington-Missin
Occasional Contributor II

Thank you @IsmaelChivite and Happy Holidays.

Useful as always.  I've got some follow up questions if you don't mind.

Firstly, what workflows have you encountered where there is a need to export the filename as a separate field.  I ask because my brain has assumed that there is some nifty automation trick you've encountered and I can learn a useful trick.

Secondly, what is the best way to export the photos from AGOL so they can be dropped into something like SharePoint.  Can we leverage PowerAutomate/Make do this for you?  What if we wanted to do a batch export rather than a live-stream export?  

Finally, and spinning off that last question.  Let's say I've created a simple "observations" feature service that is designed to capture photo observations from mobile teams.  If I decide to link that feature service to ALL the mobile apps, (e.g. FieldMaps, QC and S123) then is there a nifty trick to get all the attachments to a SharePoint folder with a single call, e.g. sync AGOL and Sharepoint every 3 hrs (for example) or does it require an PowerAutomate/Make intervention between each app and AGOL feature service (e.g. 3 x PowerAutomate/Make scenarios)?

I think this post answers my questions mostly.  The only thing missing really is how could a nonGIS user achieve the same outcome?

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-download-survey-da...

All the best,

Liam

ChelseaRozek
MVP Regular Contributor

Can you update the photo with house_front and house_back that uses format_date? It didn't work for me in the web app until I changed it to format-date like the other screenshots have.

AdriannaBarton
New Contributor III

Is there a way to put a calculationmode setting on the file name calculation? I have the photo name calculating in a separate field, if the user changes something within the photoname field, the file name is not updating along with the calculation/name field. Any tips would be appreciated. Hopefully more dynamic file naming capabilities are on the way! Thanks.

LynnBerni
Occasional Contributor II

I actually like the default filename for photos because it includes both the fieldname and the date, but I just want to also add the site name to help distinguish where the photos are taken.

We have a TON of image questions in our survey and it will be much easier to copy paste the fileName formula if I can include the fieldname in the formula. Is this possible?  

Hammers211
New Contributor III

Does this not work when browsing for and uploading an image file? I have it working when a new image is taken, but it doesn't work when I select a file and upload it.

Tiff
by
Occasional Contributor III

I am having trouble setting up my photo file names correctly with a survey intended to be filled out via a mobile browser. Does the file name functionality differ between web and field app?

The file name functionality works for me when previewing the survey in Survey123 Connect but I believe in the phone browser, taking an image seems to override the file name for me to "image.jpg" and selecting an existing image from a photo album also generates a random file name - not the file name customized in Survey123 Connect.

I am also experiencing issues where I have the bind::esri:parameters image parameters set to allowRename=false, but I am able to rename in both the Survey123 Connect preview and in the mobile browser. My cell looks something like this: fileName=concat(${ID_num}, "-", format_date(now(),"%Y%m%d"), "-", format_date(now(), "%H%M%S")) fileNameVisible=true allowRename=false

 

JamieUrquhart
New Contributor II

@IsmaelChivite I too am delighted that this functionality has come online.

However I find that I'm still having troubles with it.

Using Survey 123 Connect version 3.17.55.0 to design the survey I've been trying to implement specific file names for images related to a Survey Point ID Reference(Label) or survey_ID (name). 

In fact I'm taking three images at each specific survey point, an Upstream, Downstream and Centre and they are all related to the same survey_ID. However when I have tried the various versions as illustrated in the following links i cannot get them all to work. Often only one will work and the others are default names.

https://community.esri.com/t5/arcgis-survey123-blog/what-s-new-in-arcgis-survey123-june-2022/ba-p/11...

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-set-the-file-name-...

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformmedia.htm#ESRI_SECTION2_D007264B8F...

Yet I seem to get nowhere when running the published survey on the field app and end up with just a default name for each image.

What I'm trying to achieve is something like "Dee_05_a_image_downstream_20230517-233210.jpg" and "Dee_05_a_image_Centre_20230517-233215.jpg" etc.

Here is the XLS form survey data I'm using.

Any pointers would be most welcome.

Best regards Jamie

JamieUrquhart_0-1684746971363.jpeg

 

 

MeganMuellerRMW
New Contributor II

Can you use this process to set the names for file attachments in addition to photos?  For example, can you use it to set the file names for PDF or XLS attachments?  

 

trashbaby
New Contributor II

I'm getting inconsistent  results with the filenames. the first image will be the automatic default multiline image name, but the second image taken will be according to the filename I set in the bind:esri:parameters column...

 

I had it working fine before but now it's doing this!

trashbaby
New Contributor II

@JamieUrquhart I'm having the same issue. Seemingly at random, one custom image name will work but the rest will not. at various times, questions that had at one point produced the correct custom filename will not work and output the default file name. There doesn't seem to be any discernable pattern.

I've also had all of the custom filenames work for a survey, then when going in later to the same unaltered survey, the filenames returned are the default style.

Could this be a bug @IsmaelChivite ?

JoeBryant1
Occasional Contributor III

I'm also getting this behavior, seemingly at random, while testing in Survey123 Connect (I have not published yet). It was working, now it is reverting back to the default naming convention on some image questions but not others.

My survey is based on a pre-existing feature service, and I am using the OBJECTID field (bind::esri:fieldType = null) as a prefix to the question name and timestamp.

Survey123 Connect Version 3.19.115