<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic (Potential) Bug Report - Inconsistent Triggering of Update Processes in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/potential-bug-report-inconsistent-triggering-of/m-p/1294426#M937</link>
    <description>&lt;P&gt;Hello Esri community,&lt;/P&gt;&lt;P&gt;I hope you are all doing well. I recently encountered a bug while working with an attribute rule on a point feature class, and I wanted to reach out to the forum to see if anyone else has experienced a similar issue or if I am potentially making a mistake that I haven't been able to identify yet.&lt;/P&gt;&lt;P&gt;The purpose of my script is to add vertexes to a line feature when it intersects with specific point features. To assist in debugging and determining if the script is triggered during update processes, I inserted an error message to check for its execution. To my surprise, I discovered that the script is not triggered when I attempt to move an existing point feature around.&lt;/P&gt;&lt;P&gt;Upon further investigation, I observed the following behavior, which might help in diagnosing the issue:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Updates are triggered when attempting to move long-existing features.&lt;/LI&gt;&lt;LI&gt;Updates are not triggered when inserting a new feature and subsequently moving it around. Strangely, after this process, I can freely move all other point features, which should not be possible.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I'm having difficulty pinpointing the exact cause of this behavior and determining if I have made a mistake in my script or if this really is an esri bug. I would greatly appreciate any assistance or insights that you can provide.&lt;/P&gt;&lt;P&gt;Thanks and kind regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;This was the script + return error i used:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// This was added to check if the rule is even triggerd, with this statement i found the potential bug. 
return {"errorMessage": "triggered2"};

// get intersecting line features
var lines = FeaturesetByName($datastore, "PipelineLine", ["GlobalID"], true);
var i_lines = Intersects(lines, $feature);
if (isEmpty(i_lines)) {
    return {"errorMessage": "didnt find intersecting line"};
}

// create update variable
var updates = []; 

// get distances from start and end point
for (var line in i_lines) {
    return {"errorMessage": "got line geo" + Text(Geometry(line))};
    var line_geo = Geometry(line);
    var point_geo = Geometry($feature);
    var d_start = Distance(point_geo, line_geo.paths[0][0]);
    var d_end = Distance(point_geo, line_geo.paths[-1][-1]);

    // get the new point coordinates: x/y from the closest line end point, z from the point
    var i = IIf(d_start &amp;lt; d_end, 0, -1);
    var v = [line_geo.paths[i][i].x, line_geo.paths[i][i].y, point_geo.z, null];

    for (var k = 0; k &amp;lt; Count(line_geo.paths[i]); k++) {
        if (line_geo.paths[i][k].x == v[0] &amp;amp;&amp;amp; line_geo.paths[i][k].y == v[1] &amp;amp;&amp;amp; line_geo.paths[i][k].z == v[2]) {
             return;
        }
    }

    // add vertex at start or end of line
    var new_line_geo = Dictionary(Text(line_geo));
    var j = IIf(i == 0, 0, Count(new_line_geo.paths[0]));
    Insert(new_line_geo.paths[0], j, v);
  
    var update = {
        "globalID": line.GlobalID,
        "geometry": Polyline(new_line_geo)
    };
    Push(updates, update);
}

return {
    edit: [{
        "className": "PipelineLine",
        "updates": updates
    }]
};&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 31 May 2023 11:02:28 GMT</pubDate>
    <dc:creator>StefanAngerer</dc:creator>
    <dc:date>2023-05-31T11:02:28Z</dc:date>
    <item>
      <title>(Potential) Bug Report - Inconsistent Triggering of Update Processes</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/potential-bug-report-inconsistent-triggering-of/m-p/1294426#M937</link>
      <description>&lt;P&gt;Hello Esri community,&lt;/P&gt;&lt;P&gt;I hope you are all doing well. I recently encountered a bug while working with an attribute rule on a point feature class, and I wanted to reach out to the forum to see if anyone else has experienced a similar issue or if I am potentially making a mistake that I haven't been able to identify yet.&lt;/P&gt;&lt;P&gt;The purpose of my script is to add vertexes to a line feature when it intersects with specific point features. To assist in debugging and determining if the script is triggered during update processes, I inserted an error message to check for its execution. To my surprise, I discovered that the script is not triggered when I attempt to move an existing point feature around.&lt;/P&gt;&lt;P&gt;Upon further investigation, I observed the following behavior, which might help in diagnosing the issue:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Updates are triggered when attempting to move long-existing features.&lt;/LI&gt;&lt;LI&gt;Updates are not triggered when inserting a new feature and subsequently moving it around. Strangely, after this process, I can freely move all other point features, which should not be possible.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I'm having difficulty pinpointing the exact cause of this behavior and determining if I have made a mistake in my script or if this really is an esri bug. I would greatly appreciate any assistance or insights that you can provide.&lt;/P&gt;&lt;P&gt;Thanks and kind regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;This was the script + return error i used:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// This was added to check if the rule is even triggerd, with this statement i found the potential bug. 
return {"errorMessage": "triggered2"};

// get intersecting line features
var lines = FeaturesetByName($datastore, "PipelineLine", ["GlobalID"], true);
var i_lines = Intersects(lines, $feature);
if (isEmpty(i_lines)) {
    return {"errorMessage": "didnt find intersecting line"};
}

// create update variable
var updates = []; 

// get distances from start and end point
for (var line in i_lines) {
    return {"errorMessage": "got line geo" + Text(Geometry(line))};
    var line_geo = Geometry(line);
    var point_geo = Geometry($feature);
    var d_start = Distance(point_geo, line_geo.paths[0][0]);
    var d_end = Distance(point_geo, line_geo.paths[-1][-1]);

    // get the new point coordinates: x/y from the closest line end point, z from the point
    var i = IIf(d_start &amp;lt; d_end, 0, -1);
    var v = [line_geo.paths[i][i].x, line_geo.paths[i][i].y, point_geo.z, null];

    for (var k = 0; k &amp;lt; Count(line_geo.paths[i]); k++) {
        if (line_geo.paths[i][k].x == v[0] &amp;amp;&amp;amp; line_geo.paths[i][k].y == v[1] &amp;amp;&amp;amp; line_geo.paths[i][k].z == v[2]) {
             return;
        }
    }

    // add vertex at start or end of line
    var new_line_geo = Dictionary(Text(line_geo));
    var j = IIf(i == 0, 0, Count(new_line_geo.paths[0]));
    Insert(new_line_geo.paths[0], j, v);
  
    var update = {
        "globalID": line.GlobalID,
        "geometry": Polyline(new_line_geo)
    };
    Push(updates, update);
}

return {
    edit: [{
        "className": "PipelineLine",
        "updates": updates
    }]
};&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 31 May 2023 11:02:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/potential-bug-report-inconsistent-triggering-of/m-p/1294426#M937</guid>
      <dc:creator>StefanAngerer</dc:creator>
      <dc:date>2023-05-31T11:02:28Z</dc:date>
    </item>
  </channel>
</rss>

