I'm working with a feature layer and a separate table that have a column in common (many to one relationship). The feature layer common field name is PropName and the table field name is GIS_PropName. I'm attempting to use FeatureSets to get the value of a second field called WMAName using Arcade. I can get as far as the below but when I change the last line to:
return target.WMAName;
I get the following error. Execution Error:Runtime Error: Cannot call member property on object of this type. WMAName
Solved! Go to Solution.
In this case target is a collection of records, which might only have one record. You can do something like this:
var target = First(Filter(tbl, sql));
return target.WMAName;
// or
var target = Filter(tbl, sql);
return target[0].WMAName;
In this case target is a collection of records, which might only have one record. You can do something like this:
var target = First(Filter(tbl, sql));
return target.WMAName;
// or
var target = Filter(tbl, sql);
return target[0].WMAName;
Thanks Xander. That first method worked.
Mitch East
GIS Specialist 3, Game Management
Wildlife Resources Division<http://georgiawildlife.com/>
O: (706) 557-3270 | M: (678) 787-5627
Facebook<http://www.facebook.com/WildlifeResourcesDivisionGADNR> • Twitter<http://twitter.com/georgiawild> • Instagram<http://www.instagram.com/georgiawildlife>
Buy a hunting or fishing license today!<http://georgiawildlife.com/licenses-permits-passes>
—————————————————
A division of the
GEORGIA DEPARTMENT OF NATURAL RESOURCES
I'm glad it worked. Just remember that the filter will return a collection even if the collection contains only a single record. You will have to drill down to the record to be able to query the individual attribute values.
Hello! In Workforce is a related table with assignment types. I am trying to pull the assignment types description field from this related table into a pop-up. I am trying to use this code (modified of course) but get an execution error. Any tips you can toss my way would be greatly appreciated!
var tbl = FeatureSetByName($map,"workforce_8b965c8647bc45d79891d13f207335c8 - Assignment Types", ['description']);
var descr = $feature.description;
var sql = "assignmenttype = '" + descr + "'";
var target = First(Filter(tbl, sql));
return target.description;
Hopefully you've solved this before now, but for others in the same boat..
A likely cause is if your filter returns nothing, First() then returns null and you're attempting to retrieve the description attribute on a null, which needs to be handled.
var target = First(Filter(tbl, sql));
if(IsEmpty(target)) return '';
return target.description;