For this script right here, I am trying to get the endpoints of a new feature when it is created, then place a point on the end when it intersects with another feature of the same class that has a different value for the placement entry in the attribute table. So far the logic looks sound, but on line 14 I get a "Close parenthesis expected" error, even though there are no other open parentheses anywhere else in the script. Would this just be a weird syntax error?
var point_class = FeaturesetByName($datastore, "attributeruletest.sde.Riser");
var fibercable = FeaturesetByName($datastore, "attributeruletest.sde.Fibercable", ["placement"]);
function get_endpoints($feature) {
var geom = Geometry($feature);
if (Count(geom["paths"]) > 0) {
var last_point = Point(Geometry($feature)["paths"][-1][-1]);
return [last_point];
}
return [];
}
var new_points = [];
var endpoints = get_endpoints($feature);
if (Count(endpoints) > 0) {
if(fibercable =! $feature['placement']){
for(var idx in endpoints) {
push(new_points, {
'geometry': endpoints[idx]});
}
}
}
if (Count(new_points) == 0) {
return;
}
var edit_payload = [{
'className': point_class,
'adds': new_points
}];
return {
"edit": edit_payload
}
Solved! Go to Solution.
Switch =! to !=
Close Parentheses errors occur even when that is absolutely nowhere near the actual issue. I do not know why and it drives me nuts.
Switch =! to !=
Close Parentheses errors occur even when that is absolutely nowhere near the actual issue. I do not know why and it drives me nuts.