I'm having trouble with an if/else statement for an expression that evaluates the intersection of two polygons.
I get the first return, or the correct value(s) for the "if" portion, but nothing for the else portion.
Thanks for any help.
Best,
Aaron Y.
// Define a variable to hold the FeatureSet of the intersecting layer.
// Replace "Polygon Layer Name" with the actual name of your polygon layer in the map.
var intersectLayer = FeatureSetByName($map, "Future Land Use Designations");
// Find the features in 'intersectLayer' that intersect the current feature ($feature).
var intersectingFeatures = Intersects(intersectLayer, $feature);
// Initialize an empty array to store the attributes you want to display.
var attributesToDisplay = [];
// Iterate through the intersecting features and extract desired attributes.
// Replace "AttributeField1" and "AttributeField2" with the actual field names from your polygon layer.
for (var f in intersectingFeatures) {
Push(attributesToDisplay, f['FLUM_Cat']);
}
//Remove square brackets from array and and "/" instead of comma
var myarray = attributesToDisplay;
var arrayasstring = Text(attributesToDisplay);
var nobrakets= Replace(Replace(Replace(arrayasstring, '[', ''), ']', ''),',','/');
var NoBracketsDist = Distinct(nobrakets)
// Check if any intersecting features were found.
if (Count(NoBracketsDist) > 0) {
return "This parcel is within the following Land Use Designation Categories:" + " "+ Concatenate(NoBracketsDist);}
else if (Count(NoBracketsDist) == 0) {
return "This parcel is outside of the Land Use Designation Categories";
}layers