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

7457
36
06-08-2018 05:44 AM
Occasional Contributor II
21 36 7,457

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 

36 Comments
Occasional 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. 😃

New Contributor

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

Occasional Contributor II

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

Occasional Contributor II

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.

Occasional Contributor II

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

by
Occasional Contributor III

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

Occasional Contributor II

That's fantastic, Stefano, thanks!

Occasional 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>>>>

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.

Occasional Contributor II

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.

by
Occasional Contributor III

Hi Lynn,

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

Cheers

Stefano

New Contributor II

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!

Occasional Contributor III
New Contributor III

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  

New Contributor III

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.

New Contributor III

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. 

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.

New Contributor III

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.  

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...

New Contributor II

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

Occasional Contributor II

Yes totally.

You can use the format:

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

New Contributor II

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>

New Contributor III

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. 

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.

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>')
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?

Occasional Contributor II

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?

Occasional Contributor II

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

Occasional Contributor II

Thanks Deon,

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

Occasional Contributor II

Thats super awesome! Great to be of help

New Contributor III

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

Occasional Contributor II

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 

New Contributor III

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

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.

New Contributor III

Cool! Thanks James. I will have a close look

New Contributor III

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.