I have a field in my survey (Local_Zones) that is a select one question, and I recently created a polygon layer that displays some, but not all, of the zones. The zones are set up by the surveyors, so if they provided me with GPS boundaries, then their zones were added to the layer. I've now added a simple pulldata calculation to auto fill the zone based on the surveyor's GPS location (a sample of my survey is attached).
This works great for the folks whose zones are shown on the map. For everyone else who manually selects their zone, the field is getting cleared out every time they edit or view a record from the inbox, presumably because their location is not within a zone on the map. The only thing I've found to prevent this from happening is to set the calculation mode to manual, but that defeats the purpose of setting it up to auto fill in the first place. These are the other things I've tried.
- Setting the calculation mode to auto or whenEmpty.
- Updating my version of Survey123 Connect, just in case (I'm running 3.22.49).
- Using various If statements with different attributes to try to limit when the pulldata calculation applies, including using a hidden field for pulldata("@property", 'mode') to limit the calculation to new surveys.
None of these worked and ultimately, the If statements aren't helpful because the underlying issue seems to be that the calculation is running when it shouldn't be, which clears out the previous answer. I only want the calculation to run when the user is filling out a new survey - then the answer needs to be preserved when editing or viewing. Based on this info, even if auto wasn't the correct calculation mode, I would have at least thought that whenEmpty would do the trick, so I'm not sure why it seems to always recalculate unless it's set to manual.
If anyone has any ideas, I'm all ears. @IsmaelChivite, am I missing something with how the calculation mode works or is this the expected behavior? Thanks in advance!