Prepopulate survey with feature service and csv

262
1
05-02-2019 12:20 PM
by Anonymous User
Not applicable

Hello:

Any advice on how to prepolute a survey with both a csv and a feature class that will share a common field? I have seen inserting a link in a web map pop up to use feature class fields and using pulldata to use the csv. What is the best way to combine both? 

Workforce for ArcGIS

0 Kudos
1 Reply
DougBrowning2
Occasional Contributor III

Are the two related using a relationship class?  If so you can enable fields from the related csv/table on the pop up of the feature class and then send it all from there.  It for sure will work as a related table. 

You could also use Arcade to calculate in the Feature class pop up then send that value.  (note this does not work in collector yet so maybe not an option -works in a browser though)

Here is some sample code I use to go find the matching records in the current map.  In this case I report issues (only on plots with a status Eval) but you could grab data.  (also esri why no Arcade syntax option?)

if ($feature.EvalStatus == "Eval") {
var sql = "PlotKey = '" + $feature.PlotKey + "'";
var tbl = Filter(FeatureSetByName($map,"Plot Observation"), sql);

var tblCnt = count(tbl)
if (tblCnt < 1) {
    return "\n----No Plot Observation form found!"
}
else if (tblCnt > 1) {
    return "\n----More than 1 Plot Observation form found!"
}
else {
    return ''
}
}
else {
    return ''
}

Slightly more complicated example where I go grab some data from a diff table and check the data pattern.

if ($feature.EvalStatus == "Eval") {
var sql = "PlotKey = '" + $feature.PlotKey + "'";
var tbl = Filter(FeatureSetByName($map,"LPI"), sql);

var txt = ''
for (var f in OrderBy(tbl,"LineNumber")) {
    txt = txt + f.LineNumber + ' '
}
txt = Left(txt,Count(txt)-1)
if (txt != '1 2 3') {
    return "\n----LPI Line Number Issue! Found: " + txt
}
else {
    return ''
}
}
else {
    return ''
}
0 Kudos