What does the "a._known.slice is not a function" error message mean?

343
1
08-12-2020 11:49 AM
FranciscoRodriguez2
New Contributor II

I have previously used this Arcade expression with other datasets and haven not had any issues, I tried running this expression today: 

var portal = Portal('https://mass-eoeea.maps.arcgis.com');
var features = FeatureSetByPortalItem(portal, 'ed174bb08dc34850ac8d0e719cae0c72', 0, ['*'], true);

var open = $feature;
var landid = contains(open, features);

var cnt = Count(landid);

var resultado = "This Open-Space parcel contains " + cnt+ " "+ "Land ID Points";
for (var f in landid) {
resultado += TextFormatting.NewLine + "Land Id(s):" + text(f.id)
}

return resultado

When I test the expression out in the webmap, I get the expected results:

Result :Value
Result: This Open-Space parcel contains 1 Land ID Points
Land Id(s):10196
Type: String

However, when I try running the expression using  the field calculator on a string field (255 characters) in the $feature, I keep getting this error message, 

a._known.slice is not a function

Can anyone point me in the right direction as to what I am doing wrong with my syntax?

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Francisco Rodriguez ,

I have not seen that error before and  to be honest and I don't know why it is happening. 

I do see a couple of things:

  • You are retrieving the point layer using  FeatureSetByPortalItem, but you specify all the fields and also the geometry. I think you could optimize the code by using ... , 0, ['id'], false); since you only use the id field afterwards.
  • How many point can there be in a polygon. Your text will grow fast since for each ID you add a new line. Wouldn't it be better to present a list of Id's separated by commas?

Something like:

var portal = Portal('https://mass-eoeea.maps.arcgis.com');
var features = FeatureSetByPortalItem(portal, 'ed174bb08dc34850ac8d0e719cae0c72', 0, ['id'], false);

var open = $feature;
var landid = contains(open, features);
var cnt = Count(landid);

var resultado = "This Open-Space parcel contains " + cnt + " Land ID Points";
resultado += TextFormatting.NewLine + " - Land Id: ";
var lst = [];
for (var f in landid) {
    lst[Count(lst)] = f.id;
}
resultado += Concatenate(lst, ", ");
return resultado;
0 Kudos