HTML Links for Survey123 to just about anything (work in progress)

21140
43
06-08-2018 05:44 AM
DeonLengton
Esri Contributor
27 43 21.1K

Do you want to create a break-out link from your survey to Twitter, WhatsApp, eMail etc?

Here are a few examples of how the HTML tags should look like to achieve this (just substitute your fields into the examples and paste it into a survey note field):

 Open the device's default mapping application (such as Google Maps) with the coordinates of the survey:

concat('<a href="geo:', ${Lat}, ',' , ${Long}, concat('">Display on the Map</a>'))

 Open Google Maps with driving directions to coordinates:

concat('<a href="http://maps.google.com/maps?daddr=', ${Lat}, ',' , ${Long}, concat('&amp;ll=">Directions</a>'))

 Open the device's default email application with a to email address:

concat('<a href="mailto:', ${Email},concat('">', ${Email}))

 Create a Tweet from your survey:

concat('<a href="https://twitter.com/intent/tweet?text=This tweet sent from Survey123! #ArcGIS','">Create a Tweet</a>')

 Create a WhatsApp message from your survey:

concat('<a href="whatsapp://send?text=This is a WhatsApp message from Survey123!">Create a Whatsapp message</a>')

 Open Collector with a specific web map:

${Collector_Intent} = concat('arcgis-collector://?itemID=68085fc05c401ca5716e5677a6128c')
concat('<a href="',${Collector_Intent},'">Open Collector</a>')

(first create a calculated field named Collector_Intent and then use that field in the second calculated field)

 Open a specific survey (with parameters) from Survey123:

${S123_Intent} = concat('arcgis-survey123://?itemID=887d507cee48d18ad3cdfaf9f081e6&field:Service_Rating=1')
concat('<a href="',${S123_Intent},'">Open specific survey</a>')

(first create a calculated field named S123_Intent and then use that field in the second calculated field)

 Open an SMS (with the coordinates in the body) from Survey123 (this works in Android - not tested on iOS):

concat('<a href="sms:','08212345678','?body=', ${Lat}, ',' , ${Long}, concat('">SMS</a>'))

(to get the coordinates - just use the pulldata() function)

 Open a local file (such as a PDF help file or an image located in your survey's media folder) from Survey123 - this works and has been tested on Android:

concat('<a href="file:///storage/emulated/0/ArcGIS/My Surveys/549c05bae0f14e388000486ce4de950c/esriinfo/media/Example.pdf" class="link external button button-raised button-fill color-blue">Demo</a>')

(549c05bae0f14e388000486ce4de950c will be different for each survey. It refers to the survey item id)

I will add more examples as the need arises 

43 Comments
RogerMesen-Delgado
Frequent Contributor

Thanks, very useful. I been tried the differents links and I've some ideas to implement with my surveys. Waiting for the next examples. 😃

by Anonymous User
Not applicable

Thanks, this is really helpful!

I"m building a survey in Survey123 Connects and submitting answers via the web form.  I'm trying to dynamically create a link that opens in a new tab.  I've got the link working fine but every time I publish the survey, the target="_blank" is removed from the link and the link opens in the same tab as the survey.  This is a problem because when the user clicks on the link and then goes back to the survey, all of their answers have disappeared. 

On a side note, the reason I'm trying to create the link to Google Maps is because the web form won't pre-populate the geopoint with the location.  I got it to work just fine in the app but no luck in the web form.

Thanks,

Ian

FinnianO_Connor
Deactivated User

Hi Deon,

Great post and really useful. Have you an example of how you could open a regular SMS message (iPhone or Android) and populate with data? I'd like to be able to send an SMS with lat/long.

Cheers,

Finnian

DeonLengton
Esri Contributor

Hi Finnian

I've added your request! Please test it out and let me know. I can only test on Android for now but would be good if you can test on iOS as well.

FinnianO_Connor
Deactivated User

Deon,

Works great on Android, thank you. I needed to make a slight change for it to work on iOS - instead of ?body, it has to be &body. Not sure if there is a way to identify the OS from Survey123  to allow the correct choice be automatically made, but always can present the user with the two options.

Cheers,

Finnian

SMauri
by
Frequent Contributor

Hi Finnian,

you can check OS of your device using "property('uri:deviceid')" function in calculation column

Device and user properties — Survey123 for ArcGIS | ArcGIS 

Cheers

Stefano

FinnianO_Connor
Deactivated User

That's fantastic, Stefano, thanks!

JumaKhudonazarov
Regular Contributor

can you create relationship between survey questions? For instance I need  % of people aged  60 years old who have disability and have no access to health care? Or similiar>>>>

JamesTedrick
Esri Esteemed Contributor

Hi Juma,

Are you asking about creating a question in a form that derives it's value from previous questions in the form?  You can do that using formulas - Formulas—Survey123 for ArcGIS | ArcGIS .  If you are looking to graph the results of your survey based on multiple variables, there are a few different tools that can do this - Operations Dashboard, Web AppBuilder, Insights, etc.

LynnBerni
Frequent Contributor

Is there a way to open up an excel sheet from within a survey, and then have a field in the spreadsheet populate a field in the survey?  Specifically, we have a simple streamflow calculator, and "Avg Flow (CFS)" is what we want in the survey.

SMauri
by
Frequent Contributor

Hi Lynn,

Please ask a new question for your problem, because I'm afraid you are off topic.

Cheers

Stefano

KingTides
Emerging Contributor

Hi Deon, 

I was attempting to use the email code you had above but ran into error code 400 invalid html format. Another error I got was that $Email could not be found or something along those lines. I most likely formatted it incorrectly but was wondering if you ( or anyone) could help me out. Sorry I don't have much experience with HTML or coding in general so I most likely butchered it. 

<!DOCTYPE html>
<html>

concat('<a href="mailto:nckingtides@gmail.com', ${Email},concat('">', ${Email}))

</html>

What I want to do is have a link on the bottom of my survey that someone can click and their email opens with an auto populated email in the "to" field. Any advice would be very appreciated.

Thank you!

by Anonymous User
Not applicable
Fco_JavierRomero
Occasional Contributor

Muy buen aporte, Enhorabuena.

No se si puedes ayudarnos, estamos intentando buscar la forma de abrir la aplicación OpenCamara en Android (https://sourceforge.net/projects/opencamera/) en Survey123 y no encontramos el HTML  link que lo haga.

Saludos  

Fco_JavierRomero
Occasional Contributor

No problem for me:

"Very good contribution, Congratulations.

 

I do not know if you can help us, we are trying to find a way to open the OpenCamara application on Android (https://sourceforge.net/projects/opencamera/) in Survey123 and we can not find the HTML link that does it.

Thank you."

... an for you, remenber the GeoNet Community Guiding Principles:

Be Smart.

Be Human.

Be Helpful.

MikailaBell
Regular Contributor

This is a great resource, thank you for posting it.

I am struggling to adapt these instructions to open a local file (PDF from the media folder) for iPad.

Do you (or anyone else) have the iOS link figured out?

I have been looking here: Accessing Files and Directories  and can't seem to find a file structure for local media on iOS. 

JamesTedrick
Esri Esteemed Contributor

Hi Mikaila,

iOS doesn't allow access to the file structure.  The best I can think of is to have the PDF preloaded in a given app that can be called to open the file.

MikailaBell
Regular Contributor

Hi again! Now I'm using this in a webform, for desktop inspections. I'm back to ask if you have the links configured for Google Earth and also going straight to Google Street View. If I figure it out before I hear from you, I will post back for posterity.  

JamesTedrick
Esri Esteemed Contributor

Hi Mikaila,

For Google Streetview URLs, take a look at Developer Guide  |  Maps URLs  |  Google Developers 

I don't readily see Google Earth URL parameter settings on Google's website; I'm not sure if it's current but Fun stuff to do with the new Google Earth URL - Google Earth Blog  has some suggestions...

GabrielaQuintana_Badilla
Emerging Contributor

Hi, how could you make a link that allows you to call using the device's phone?

DeonLengton
Esri Contributor

Yes totally.

You can use the format:

<a href="tel:2125551212">2125551212</a>

GabrielaQuintana_Badilla
Emerging Contributor

Thank you Deon!!!!

De: Deon Lengton <geonet@esri.com>

Enviado el: miércoles, 12 de febrero de 2020 02:33 a.m.

Para: Gabriela Quintana <gquintana@geotecnologias.com>

Asunto: Re: - HTML Links for Survey123 to just about anything (work in progress)

GeoNet, The Esri Community | GIS and Geospatial Professional Community <https://community.esri.com/?et=blogs.comment.created>

HTML Links for Survey123 to just about anything (work in progress)

new comment by Deon Lengton<https://community.esri.com/people/dlengtonesri-southafrica-esridist?et=blogs.comment.created> - View all comments on this blog post<https://community.esri.com/groups/survey123/blog/2018/06/08/html-links-for-survey123-to-just-about-anything-work-in-progress?commentID=82776&et=blogs.comment.created#comment-82776>

by Anonymous User
Not applicable

Hello James Tedrick, are other apps not able to access the IOS files? At least the iCloud and files listed in the IOS Files app. I know that I have used scanner and markup apps for years that allow me to open PDFs from the IOS files app or from files shared on iCloud (Bluebeam, Scanner Pro, Drop Box, to name a few). Is there any way for me to attach PDFs in Survey123? It seems that for 'file'; type questions I can only access the photo library. 

JamesTedrick
Esri Esteemed Contributor

Hi Sam,

The discussion above was regarding the general file system, not iCloud.  As you note, iOS does allow interaction via iCloud and (in very recent years) the Files application to allow for applications to share files.  Based on this (and work in AppStudio to support iOS's allowable interface), we are evaluating when support for a general file question can be added.

OliviaNiziolek
New Contributor

Good afternoon, 

 I am trying to create a link from 1 survey in Survey123 field app to open another survey in the Survey123 field app. I am having success with the hyper link  ( concat method you describe)on my computer (running survey123 app) but not on my ipad ( running the app). The link when viewed on the ipad doesn't act like a link whatsoever.

Thoughts?

 Open a specific survey (with parameters) from Survey123:

${S123_Intent} = concat('arcgis-survey123://?itemID=887d507cee48d18ad3cdfaf9f081e6&field:Service_Rating=1')
concat('<a href="',${S123_Intent},'">Open specific survey</a>')
JamesTedrick
Esri Esteemed Contributor

Hi Olivia,

On your first line of code, you have an assignment operation with an = sign.  Is that literally what is present in your form (which would be invalid- you would have the portion to the right of the = sign be a calculation for the question with the name S123_Intent).  Is there a reason you have this in 2 lines, as opposed to 1 larger concat expression?

AdamDaily
Frequent Contributor

Im trying to add a pdf link using the example at the start of this blog. The calculation shown displays a link in my Survey Connect form, but the link does not open the pdf or even look like an active link when hovered over or clicked on. I'm guessing my survey item ID is not correct, but if this is not the name of my survey (or survey folder), where do i find the item ID of an unpublished survey for testing the pdf link in Survey Connect?

DeonLengton
Esri Contributor

Hi Adam

I would propose that you first get your URL to work manually and then try to put it in the HREF structure.

It is always hard to get it right the first time and to figure out the slashes in the url.

Once that works put the hardcoded URL in Survey123 then start making it dynamic

AdamDaily
Frequent Contributor

Thanks Deon,

Your advice pointed me in the right direction. I have it working now!

DeonLengton
Esri Contributor

Thats super awesome! Great to be of help

ReneAubut
Regular Contributor

Hi, I have 2 distinct forms on Survey123: one for loaded truck weights at loading site and one for unloaded truck weights at disposal site. In the disposal site form, I would like to perform a calculation to subtract the weight of the empty truck from the weight of the loaded truck, giving me the net weight. Both forms have a manifest ID value used to link proper records between the 2 forms

From your post, I understand that I need to create, in the disposal form, an Decimal question which would receive the matching weight value from the loading form, by typing in the calculation cell, something similar to (not too sure...) concat('arcgis-survey123://?itemID=... &field:ManifestID=${ManifestID}')

Thanks in advance

DeonLengton
Esri Contributor

Hi Rene

From previous experience I think you need to do your relationship class based on a GUID field.

I would create a manifest_guid in the parent table and a similar field in the disposal table and then create the relationship class based on this GUID.

Then your linking should work similarly to how you wanted to pass the ManifestID over to the disposal survey to link the related table back to the main table.

Regards

Deon 

ReneAubut
Regular Contributor

Thanks for your reply Deon

Is there any operators that could be used in the calculation column that would work similar to the Survey123 Connect Inbox settings where a Query expression can fetch specific records from the hosted feature layer, but in my case from a different feature layer than the one linked to the form. Am trying to automatically calculate a net weight question from inputs coming from 2 distinct feature layers.

I have also looked at doing this in ArcGIS Online where my 2 feature layers are hosted. In the Web Map, I have performed a join on the 2 tables. The resulting join table has both weight values (at loading and at disposal), but there are no apparent way of having the net weight automatically calculated as new data records are captured by our field workers

JamesTedrick
Esri Esteemed Contributor

Hi Rene,

This sounds like something that could be done with eh new Custom JavaScript capability - Extending Survey123 smart forms with custom JS functions .  Several of the samples for that involve retrieving data from a feature service and then manipulating it.

ReneAubut
Regular Contributor

Cool! Thanks James. I will have a close look

AndrewPadilla
Frequent Contributor

Is there a way to use a hyperlink to go to a group of questions in the same survey? For example, I am asking for a unique access code to take the survey. However, I would like the ability to allow users to continue without the code by providing name and address as a verification (similar to the US census). A simple "I don't have my access code" hyperlink would make the name and address group appear, without the bulk and confusion of a yes or no question. Thank you for your time.

mapmcburney
Occasional Contributor

Hello, 

Is there any update or peice I might be missing for referencing a local PDF file?

I have the PDF in my media folder. The survey is published and when I browse the internal memory in Windows I see it on my Android tablet here;

"This PC\Galaxy Tab S3\Tablet\ArcGIS\My Surveys\8fafcc5c606a4758836fa8b24cef216a\esriinfo\media"

In the Note field of my Survey the calculation reads as:

concat('<a href="file:///storage/emulated/0/ArcGIS/My Surveys/8fafcc5c606a4758836fa8b24cef216a/esriinfo/media/HelpFile.pdf" class="link external button button-raised button-fill color-blue">Help</a>')

Yet, my file will not open...am I missing something?

DeonLengton
Esri Contributor

Hi 

I would suggest testing the href path in a browser on your device. Once that works then just paste the path into the href url - its always tricky to find the exact location and slashes to get to those files on local storage.

Maybe this article will help: https://stackoverflow.com/questions/50111170/android-url-scheme-to-open-file-from-browser-link

I saw someone make the following suggestion: "How can one determine the local path easily? Open a locally stored image with the default image viewer, select image details in the context menu. This will include the absolute path on your given system."

 

Hope that helps!

Regards

Strahanjen
Frequent Contributor

Is it possible to create a link that would navigate directly to a particular record in a repeat? Here's the use case: Biologists enter fish observations summarized by species including length min/max, weight, number of fish, etc. I use a custom Javascript function to display the entries in a tabular format. The user would like to be able to click on a species in the table to automatically jump to that record in the repeat in order to make edits to the values. 

JavierCMartínezPrieto
Frequent Contributor

Good afternoon,
I have seen that showing a pdf through the demo button is possible, but I can't find the necessary path, I have tried with the one provided in arcgis, I have tried the path of my survey desing inside the media folder, but it only works in the pc where the file is.
could you tell me what is the path that must be inserted with a real example, if it is the path of the pc or the url of arcgisonline. and please could you indicate in which field is entered in the survey, in calculation, in apparence, etc..

Greetings

Strahanjen
Frequent Contributor

I'm close to a solution for clicking a link to open a PDF in the media folder on an iPad, using a URL that looks like this:

shareddocuments:///On%20My%20iPad/Survey123/ArcGIS/My%20Surveys/<surveyformitemID>/esriinfo/media/test.pdf

This opens the media folder where the PDF is located but then I have to click on the file to view it. I wonder if anyone can figure out what changes I need to make to actually open the pdf? 

I came across the information about the shareddocuments approach for linking to a file here:

https://www.macstories.net/ios/fs-bookmarks-a-shortcut-to-reopen-files-and-folders-directly-in-the-f...

 

 

AnnetteDoonan
New Contributor

Hi Deon

Is there a way to do this with phone numbers? ie I want to put a phone number in a survey123 Connect survey and when published a user could click on it whilst the survey is open and ring an organisation to refer a person for services and when the call is finished, finish filling out the survey and then submit it.

Is this possible to do?

Many thanks

ccdRitche
New Explorer

I am using a javascript API as a html and trying to link the same as an external link. Since the file I have stored in local computer C:\Users\user\ArcGIS\My Survey Designs\Form 1\media\featuretable.html I am able to publish but I am unable to open the link after publishing any help would be deeply appreciated @DeonLengton