update geopoint with calculation using if statement

454
1
04-29-2020 12:45 PM
TregChristopher
Occasional Contributor

Hello,

I'm setting up a QC Survey123 form and would like the editor be able to:

1. move the map geopoint to a new location,

2. record new location coordinates to two lat/long attribute fields

3. either save the form with the new location or revert back to the original location, depending on whether they toggle a Yes/No question asking if they want to update the map with their loc or the originally reported location (stored in two other lat/log attribute fields).

Following calculation suggested in:Geopoints—Survey123 for ArcGIS | Documentation, I used the formula "substr(${previous_question}, 0, 10) + " " + substr(${previous_question}, -10)" to change the map location. However, I'm having difficulty toggling between two sets of coordinates, depending on the answer to the yes/no question (see examples below). 

Calculation on geopoint

1. This works to force an update the geopoint back to the original coords found in two, lat/long attribute fields:

(substr(${LatitudeReported}, 0, 10) + " " + substr(${LongitudeReported}, -10))...i.e. when I review the record again, the geopoint has been moved back to the originally reported location.

2. This gives an error "ODK Validate Errors" when I try to save the form and include an if statement to update the geopoint between the two different choices from location attribute fields:

if((${IsLocationCorrected}=20),(substr(${LatitudeReported}, 0, 10) + " " + substr(${LongitudeReported}, -10)),(substr(${WSDOT_LatitudeStateRoute}, 0, 10) + " " + substr(${WSDOT_LongitudeStateRoute}, -10)))

Am I just mis-typing the formula or this not even possible to combine the if statement with the substring calculation when updating geopoint?

0 Kudos
1 Reply
BrettStokes
Esri Contributor

Hi Treg,

Did you find a solution for this workflow? If so, please share it on the forum.

Thanks,

Brett

0 Kudos