JavaScript functions for Geopoint or Geoshape

415
3
08-08-2022 03:15 AM
WPG03WPG03
New Contributor II

I would like to write JavaScript functions that can be directly used in the calculation column of geopoint and geoshape, as follows:

xlsform.PNG

 

 

 

/*
 * JavaScript functions for Survey123
 */

function getGeoPoint() {

    // Add your code here

    return "1.0000 2.00000";
}

function getGeoShape() {

    // Add your code here

    return "0.0000 0.00000;0.1000 0.00000;0.1000 0.10000; 0.0000 0.10000";
}

 

 

 

 

However, the above JavaScript functions do not work and return the following error:

xlsform_error.PNG

It seems that the expected output is not some space-separated values of latitude and longitude.  What are the correct output from a JavaScript functions that can be directly used by geopoint and geoshape?  I can't find such documentations. 

 

Tags (2)
0 Kudos
3 Replies
WPG03WPG03
New Contributor II

bump

0 Kudos
WPG03WPG03
New Contributor II

@JamesTedrick  Grateful if you can shed some lights on this problem.  Thanks.

0 Kudos
WPG03WPG03
New Contributor II

As a workaround, modify the calculation column using the following syntax:

string(pulldata("@javascript", ...))+" "
string(pulldata("@json", ...))+" "