I have a survey with two geopoint questions:
The issue is that the "center" parameter seems to set the location of both geopoints when the survey is opened, rather than just setting the location of the non-null (default) geopoint question.
If the user clicks the locate button on the second geopoint, it recalculates and the correct values are passed to the decimal fields. But we need to automatically grab the device location without relying on the user clicking the second geopoint question (in fact, we would prefer to hide it entirely) to reset the location.
Is there a solution to this?
Try setting the default value of the second geopoint to 0,0. I use this in a form with 5 geopoints and it starts all the maps blank as seen here.
I also have the code to calc distance and give the user a message (not a constraint since sometimes the GPS goes out in a canyon and then they get stuck so just a red warning) if they are too far from where they are supposed to be if you need it.
I personally flip this and send in the where they should be as a text lat long from Field Maps then compare that to where they are. That way the form automatically goes to where they are with no interaction needed. Also we can then see right on the map how far they were since the form is where they were. May want to consider that.
hope that helps
Thanks Doug. Looks like we won't be able to hide the question in that case, since the user will still need to click the locate button to populate the lat-long fields. This may be as good as it gets - at least we won't risk the user submitting the asset location on the second geopoint, so thanks.
Thanks for the other tips as well; we need the survey points to be coincident with the asset for this particular application but that's good to keep in mind for future applications.
@DougBrowning Setting the default to 0,0 still placed the second geopoint on the ¢er= value. However, setting calculate to null and bind::esri:parameters to calculationMode=always (then making the second geopoint required) worked for me. Thanks for putting me on the right track.
I would test edits if you set calculationMode=always since it may change it if anyone edits any field later on.
One idea I used in another form is pull the lat/long then set a constraint to make sure the second point is not in the same place as the first.
Thanks again Doug, very good point. I'm planning to use the pulldata("@property", 'mode') calculation on a hidden/null question to assign the survey mode to a variable, then use that variable in the relevant column for the second geopoint and the lat/long fields populated from it (e.g., ${survey_mode}!='edit')). This way those fields will only be calculated on initial submission.