Select to view content in your preferred language

Arcade with Related Records Problem in Enterprise Webmap

508
0
03-09-2020 11:03 AM
JamesFaron
Frequent Contributor

I am having an issue with Arcade fetching related records when using a FeatureServer layer in the WebMap. The code:

var tbl = FeatureSetByName($datastore,"Raptor_Protection_Repeat");

var code = $feature.GUID;

var sql = "GUID = '" + code + "'";
Console(code);
Console(sql);

var related_data = Filter(tbl, sql);

var cnt = Count(related_data);
Console(cnt);
var result = cnt + " related records";

if (cnt > 0) {
// loop through related records
for (var row in related_data) {
// read some data and create the line you want
var line = TextFormatting.NewLine + " - " + row.PROTECTION;
// add the line to the result
result += line;
}
} else {
result = "No related records:";
}

// return the result
return result;

This works as expected if the layer in the Map is  https://myserver.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0 

But for this application, I need  https://myserver.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0 

When I try the above code as an arcade expression on the FeatureServer layer, I get the following error: 

Execution Error:Feature Not Found

The console produces the count and sql as expected. It seems to fail on loop, specifically "var row in related_data".

In Dev tools (chrome) I see the following error: /portal/jsapi/jsapi4/:346 [esri.tasks.support.optimizedFeatureSet] convertToFeatureSet:unknown-geometry [object Object]

 

Any insight here would be greatly appreciated!

Thanks,

Jim Faron

Tags (1)
0 Kudos
0 Replies