How would I map the number of Surveys Completed?

150
5
09-19-2019 06:10 AM
NathanaelWold
New Contributor II

Hello, I am working on a citizen science project where we need at least 3 surveys completed at 45 different lakes. We are using survey123 and AGOL to try and create a map showing how many surveys have been conducted and how many surveys are needed. We have tried the summarize nearby fundtion, which does not update in real time and are currently trying to join the survey feature layer with a point layer (representing each of the 45 lakes) without any success. Any thoughts would be greatly appreciated. 

0 Kudos
5 Replies
DougBrowning
MVP Frequent Contributor

If your names are consistent then you could relationship class the lake polygons and the forms together.  Then the pop up attributes list can sum the count for you for display.

You also use Arcade in the web map to query and count for you.  I query the photo FC by looking up the id.

var sql = "PlotKey = '" + $feature.PlotKey + "'";
var tbl = Filter(FeatureSetByName($map,"AIM Photos"), sql);

var tblCnt = count(tbl)
if (tblCnt < 1) {
return "\n----No AIM Photos form found!"
}
else if (tblCnt > 1) {
return "\n----More than 1 AIM Photos form found!"
}
else {
return ''
}
NathanaelWold
New Contributor II

Hi Doug, 

Thank you for the help. I just had a couple follow up questions. We are wanting this map to be dynamic, as surveys come in the map will show how many surveys are completed. If I join the two FC (Lakes and Surveys) together will that layer be dynamic?

I tried to hack your code above with no success. Would you mind looking it over? The two layers I am working with are 1) "Loon Priority Lake" and 2) "Survey Point". The common field between them is "selectTerritory". Thank you for your patience, my coding abilities are very limited.

var sql = "Loon Priority Lake = '" + $feature.selectTerritory + "'";
var tbl = Filter(FeatureSetByName($map,"Survey Point"), sql);

var tblCnt = count(tbl)
if (tblCnt < 1) {
return "\n----No Surveys Conducted"
}
else if (tblCnt > 1) {
return "\n----More than 1 Survey Conducted"
}
else {
return ''
}‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
DougBrowning
MVP Frequent Contributor

Joins are static but Relationship Classes are dynamic.

Your SQL query is off.  You are using the pop up for Loon Priority Lake so no need to give that.  What you want to write out is what field you want to query.  You are just building the text SQL string to use.

So

var sql = "selectTerritory = '" + $feature.selectTerritory + "'";

On the rest just make sure your web map has the layers named exactly how you write them here.

NathanaelWold
New Contributor II

Thank you, Doug. That did the trick!

DougBrowning
MVP Frequent Contributor

Cool.  One note is why I return '' in case you want to get fancy and warn when more or less than 3 are done. 

I am using this to show a message only if there is an issue.  So in the pop up you add your Arcade expression (using {expression/expression1}) in red.  That way if the code returns a issue it displays in red.  If no issue it returns '' and no red message.

I got it from this post here  https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-disp... 

Example