Select to view content in your preferred language

JavaScript snippet to get a vertex from a geotrace question?

371
3
Jump to solution
04-10-2024 01:39 PM
MaryGraceMcClellan
New Contributor III

I am trying to get just one vertex from a geotrace question - it seems possible using a JavaScript snippet, but I can't tell how to get into the geotrace output or what data type it is. My working snippet is below, I'm by no means proficient in JS, but this seemed to return at least something:

 

 

var lat = 0;
function myfunction(geotrace_data) {

    lat = JSON.stringify(geotrace_data);
    return lat;
}

 

0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @MaryGraceMcClellan

Here is a sample that calculates the vertex for a specified index, but this index can be hard coded vs dynamically passed in from the survey. 

Thank you,
Zach

View solution in original post

3 Replies
ZacharySutherby
Esri Regular Contributor

Hello @MaryGraceMcClellan

Here is a sample that calculates the vertex for a specified index, but this index can be hard coded vs dynamically passed in from the survey. 

Thank you,
Zach
MaryGraceMcClellan
New Contributor III

@ZacharySutherby that is incredible, thank you!!! I was trying to parse the string but this is much more useful. 

0 Kudos
MaryGraceMcClellan
New Contributor III

@ZacharySutherby  is it correct that the javascript snippets won't run when users open the survey in the browser? I read before that it wouldn't work in the browser, but I thought that meant if you use the website to develop/publish the survey then you can't use JS. Can you confirm this snippet won't run in the browser even though I published with Connect? 

0 Kudos