Select to view content in your preferred language

Close parenthesis error when all others are closed

171
1
Jump to solution
4 weeks ago
rsnider43
Emerging Contributor

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
}
0 Kudos
1 Solution

Accepted Solutions
ZachBodenner
MVP Regular Contributor

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.

Happy mapping,
- Zach

View solution in original post

1 Reply
ZachBodenner
MVP Regular Contributor

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.

Happy mapping,
- Zach