Select to view content in your preferred language

pulldata using offline layer

256
2
04-30-2025 11:48 PM
MohamedIsmael
Occasional Contributor

I used pulldata(@layer)

and called web layer "world country" and relied on a field containing country names. I used the names in a question as a choice. If the person selects a country and their location isn't there, a message will appear "Your locatio not inside the country you selected". If the country they're located in is selected, a message will appear "welcome, your location inside the country you selected".
The problem in this case is that we need the internet.

The problem I'm facing now is that I'm relying on an existing layer on web but in field work, the internet isn't available everywhere. I want to rely on a layer that doesn't need the internet. Is this possible?

 

Use this layer "world country" to compare my location with the location of the country I selected. If my location is within the country I selected, a specific idea will be implemented. If my location is not within the country I selected, another idea will be implemented.

0 Kudos
2 Replies
TylerGraham2
Frequent Contributor

Pulldata("@layer") is still online only. What you might do is create the survey with an online and offline mode using pulldata("@property", 'online') where if it is online the user gets the questions that do the pulldata(@layer) check and if they are offline they get questions that don't use the pulldata("@layer") constraint.  For the offline, you could create an offline map that shows the country boundaries, in the bind::accuracyThreshold column of the geopoint put a value of like 10 so the maps will display an error message if the position error is more than 10 meters. They would then have to look at the map they could then choose the country that matches the one shown on their map.  

Prepopulate answers—ArcGIS Survey123 | Documentation

Survey123 Tricks of the Trade: Configure a map for... - Esri Community

TylerGraham2
Frequent Contributor

So, this inspired me to revisit one of my forms and I've got a bit more elegant solution attached as an xlsx that will check when online but bypass the constraint when offline. I'd wanted to implement a similar "check if point is within a boundary" method in my form but I also had connectivity issues at some locations where data would be collected. I had played around with pulldata("@layer") in the constraint previously, but A) it had to be online and B) there was horrendous lag/crashing of the app when adding additional constraint criteria or editing the point location on the map.  

I added a pulldata("@property", 'online') condition to the constraint and that caused the app to crash. The problem was when putting pulldata("@layer") directly into the constraint column, the json that returned for spatially complex @layer features overloaded the app because of its length when trying to run through the conditional formula.  I added a pulldata("@json") that queries the json pulled in the @layer response and have it check for the relevant attribute, in your case selected country = country attribute in the json.  

For the geopoint constraint I put in if(${online_check} = 'true', ${json_rec} = ${country}, ${online_check} = 'false') which checks if the device has a connection and if so the json country attribute has to match the selected country question in the form. If it doesn't have a connection, the constraint then becomes that device is offline, and it won't lock you out of putting in a point because it can't query an online data source.  

Since you can't use pulldata(@layer) when offline, you could record the online/offline check as a field in the feature service and in your QA process if the online_check is false, trigger those responses for additional review to make sure the data is correct.  

0 Kudos