Survey123 Mobile App Truncating Number Fields?

1620
12
04-23-2019 11:14 AM
KevinThompson
New Contributor III

Hello All,

I have been experiencing an issue when bringing in the coordinates from Collector into Survey123. Within the feature service the data is stored correctly. When I try and display the coordinates within a note or a decimal within survey123 the coordinates are truncated within the mobile app on a mobile device compared to viewing it on the mobile app installed on the computer. Any cause for this or a work around?

I have tried storing it as a string and performing calculations with the number

Thanks!!

Original Thread:

How to allow the entry of decimals in a Survey123 decimal field 

Faran Zafar

Tags (1)
0 Kudos
12 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Marisa,

Thanks for trying that out - it looks like the truncation is happening in the mobile version of the web page.  We'll try to replicate and file an issue with the appropriate team.

EricPescatore
Occasional Contributor

Pretty sure I had the same issue a few minutes ago, until i realized that the Custom URL works differently when initiating from the Web Map vs Collector. 

In the web map it appears that the Custom URL does not honor the Source Layer Custom Pop-up values. But when pushing the URL from Collector the Custom Pop-up settings truncate the X/Y value to the decimal settings from the Source Feature class.

By changing the SOURCE layer Custom Pop-up on the web map which defaults decimals to 2 decimal places to 8 decimal places. The Custom URL being pushed from collector now pushes the right # of values in the URL to survey123. 

I went about setting the DESTINATION feature class CUSTOM pop-up to 8 decimal places, but honestly that layer is not being written too until the Survey is submitted. Still needs to set the Custom pop-up in both Source and Destination feature classes to 8 decimals to display and push data correctly on the mobile data.

Bonus fun fact if your USING ArcGIS Explorer to push a custom URL, the values with coded domains actually PUSH the LABEL and not the CODE. Meaning if you had integer fields 

1  = Cast Iron

The URL Will push the word "Cast Iron"  from Explorer

While in Collector it will push the proper coded domain 1.

So the CUSTOM URL function differently on each platform, Web and Mobile Apps. So just FYI.

JoshConrad1
New Contributor III

All:

I have been experiencing the same issues described in this thread: trying to create an attribute expression that calculates lat/long coordinates from a hosted feature layer, then integrate Field Maps with Survey123 to open a form and have the geopoint plot the submitted survey on top of the feature using the result of the attribute expression using a custom URL via the custom URL popup (&center=).

I have been using the below formula, which is called out in a multitude of other posts on the community page and it was correctly calculating the coordinates in ArcGIS Online Web Viewer Classic, but then when we tested this functionality in the field, the point was not mapping:

var originShift = 2.0 * PI * 6378137.0 / 2.0;

var lon = (Geometry($feature).x / originShift) * 180.0;
var lat = (Geometry($feature).y / originShift) * 180.0;

lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat, lon];

I found that this formula results in an Array data type, with associated brackets. These brackets do not show up in ArcGIS Online, but when you view the popup in Field Maps, you can see the brackets. So because of this, i tested further and in the original function, i removed the brackets in the return line, which worked but was not perfect. It was not perfect because the coordinate results ended up being truncated to 2 decimals, and even though the submitted form was executing, the point was being plotted hundred of feet away.

After 10 hours of testing and researching these threads (which by the way, all of the contributions are EXPONENTIALLY HELPFUL AND I AM SO GRATEFUL OF YOUR KNOWLEDGE) i was able to find the CORRECT SOLUTION:

1.) Create an attribute expression for latitude:

var lat;
var originShift = 2.0 * PI * 6378137.0 / 2.0;

lat = number(Geometry($feature).y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return lat;

2.) Create an attribute expression for longitude:

var lon;
var originShift = 2.0 * PI * 6378137.0 / 2.0;

lon = number(Geometry($feature).x / originShift) * 180.0;
return lon;

3.) Because of the "number" identifier, In ArcGIS Online Web Map Viewer Classic go to Configure Popups, make sure your pop up display is custom, then the important step is to click Configure Attributes. Navigate to the newly created expressions and expand the decimal places to a minimum of 5.

4.) Lastly, in the custom URL make the "&center={expression/expr3},{expression/expr4} where expr 3 is Lat and expr 4 is Long.

I have been testing since i discovered this and it has been running smoothly. Happy Mapping!

0 Kudos