Setting a geopoint default location

10-20-2020 08:31 AM
New Contributor II

We have a set of repeat questions within a survey containing a read-only geopoint location question. The repeat section asks if you wish to record the exact location, if you answer yes the surveyor can then specify the location. If the user selects no OR does not answer the question, the default location is recorded as 0,0.

I would like this to default to the survey start location ${survey_location} if a location is not specified. I have tried numerous approaches and none have worked. What is best practice to resolve this?



0 Kudos
1 Reply
Esri Notable Contributor

Hi Christina. I am not sure I totally follow your requirement here, but I gave this a try. You can download the XLSFile I attached to this message.  In short:

  • Added a read-only geopoint question to the survey. This question is populated by the Survey123 field app automatically and its value cannot be changed.
  • Added a repeat containing:
    • A yes no question
    • A geopoint question (I will call it A) with esriFieldType column set to null (presents the user a map, but the value of this question is not stored in the feature layer)
    • A geopoint question (I will call it B). For testing purposes, I show this question in the form, but you will want to set the value of this questions appearance to 'hidden'
  • If the user chooses yes in the yes_no question within the repeat, then:
    • We show geopoint A question so the user can define a new location
    • Then the geopoint question B gets this value and ignores the value from the survey read-only gepoint
  • IF the user chooses no in the yes_no question:
    • The geopoint question A is hidden
    • The geopoint question B value is set to the location of the survey

If this approach works for you, you may want to set the appearance on geopoint B to hidden.

0 Kudos