<?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 Re: Attribute rule not working anymore  in 3.1 in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1287323#M890</link>
    <description>&lt;P&gt;This bug will be addressed in 3.1.2&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use&amp;nbsp;BUG-000157390 for tracking.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2023 16:33:02 GMT</pubDate>
    <dc:creator>HusseinNasser2</dc:creator>
    <dc:date>2023-05-09T16:33:02Z</dc:date>
    <item>
      <title>Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1271804#M775</link>
      <description>&lt;P&gt;The following code was working fine in 3.0 and 2.9 bot not anymore in 3.1. Can anyone tell me what has changed? I get an "General evaluation error" on line 3:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function getInflowStreamsWithoutConnectionVertex(polyline_) {
    var inflowStreams = [];
    var candidates = Intersects($featureSet, polyline_);
    var objectId = feature_["OBJECTID"];
    for (var inflowStream in Filter(candidates, 'OBJECTID &amp;lt;&amp;gt; @objectId')) {
        var startVertex = getFirstVertexFromPolyline(Geometry(inflowStream));
        if (Intersects(polyline_, startVertex)) {
            var result = nearestPointAlongPolyline(startVertex, polyline_);
            if (!result["isVertex"]) {
                //result['polyline'] = inflowStream;
                result['startVertex'] = startVertex;
                Push(inflowStreams, result);
            }
        }
    }
    return inflowStreams
}
function getFirstVertexFromPolyline(polyline_) {
    var segment = polyline_.paths[0];
    return segment[0]
}
function nearestPointAlongPolyline(point_, polyline_) {
    /*
        finds the closest point on line_feature from point_feature
        Args:
            point_feature: Point Geometry
            line_feature: Line Geometry
        Returns: dictionary
            {distance: number,    // distance from point_feature to closest point
             coordinates: array,  // the coordinate pair of the closest point
             isVertex: bool,      // if the closest point is a vertex of line_feature
             lineSide: text}      // side of the line that point_feature is on based
    */
    var parts = polyline_["paths"]
    var x = point_["x"];
    var y = point_["y"];
    var isVertex = false;
    // Loop through each part of the geometry and each segment, tracking the shortest distance
    var shortest = [1e10];
    for (var i in parts) {
        var vertex = parts[i];
        var previous = vertex[0];
        isVertex = Intersects(point_, previous);
        for (var j = 1; j &amp;lt; Count(vertex); j++) {
            var current = vertex[j];
            isVertex = isVertex || Intersects(point_, current);
            var result = getDistance(x, y, previous["x"], previous["y"], current["x"], current["y"]);
            result[4] = previous["m"];
            result[5] = current["m"];
            if (result[0] &amp;lt; shortest[0]) shortest = result
            previous = current;
        }
    }
    // Couldn't find anything
    if (Count(shortest) == 1) return null
    return {
        "distance": shortest[0],
        "coordinates": shortest[1],
        "isVertex": isVertex,
        "lineSide": shortest[3],
        "mBeforeVertex": shortest[4],
        "mAfterVertetx": shortest[5]
    }
}
function getDistance(x, y, x1, y1, x2, y2) {
    // adopted from https://stackoverflow.com/a/6853926
    var A = x - x1;
    var B = y - y1;
    var C = x2 - x1;
    var D = y2 - y1;
    var dot = A * C + B * D;
    var len_sq = C * C + D * D;
    var param = -1;
    if (len_sq != 0) //in case of 0 length line
        param = dot / len_sq;
    var xx, yy;
    var is_vertex = true;
    if (param &amp;lt; 0) {
        xx = x1;
        yy = y1;
    }
    else if (param &amp;gt; 1) {
        xx = x2;
        yy = y2;
    }
    else {
        is_vertex = false;
        xx = x1 + param * C;
        yy = y1 + param * D;
    }
    var dx = x - xx;
    var dy = y - yy;
    return [Sqrt(dx * dx + dy * dy), [xx, yy], is_vertex, side_of_line(x, y, x1, y1, x2, y2)];
}
function side_of_line(x, y, x1, y1, x2, y2) {
    // get side of line segment that a point (x, y) is on based on the direction of segment [[x1, y1], [x2, y2]]
    // adopted from https://math.stackexchange.com/a/274728
    var d = (x - x1) * (y2 - y1) - (y - y1) * (x2 - x1)
    if (d &amp;lt; 0) {
        return 'left'
    } else if (d &amp;gt; 0) {
        return 'right'
    } else {
        return null
    }
}
function insertVertex(polyline_, point_, mBeforeVertex) {
    var dict = Dictionary(Text(polyline_));
    var parts = dict.paths
    for (var i in parts) {
        var part = parts[i];
        for (var j = 0; j &amp;lt; Count(part); j++) {
            var vertex = part[j];
            if (Round(vertex[2],4) == Round(mBeforeVertex,4)) {
                var m = Round(vertex[2] + Distance(createPoint(vertex, 0, point_["spatialReference"]), point_), 4);
                Insert(dict.paths[i], j + 1, [point_['x'], point_['y'], m]);
            }
        }
    }
    dict["hasM"] = true;
    return Polyline(dict)
};
function createPoint(coordinates, m, spatial_ref) {
    // create point geometry from coordinates [x, y]
    return Point({ "x": coordinates[0], "y": coordinates[1], "m": m, "spatialReference": spatial_ref })
}
/***************************************************************************************/
var feature_ = $feature;
//var feature_ = First(Filter($featureSet, "objectId = 1"));
var inflowStreams = getInflowStreamsWithoutConnectionVertex(Geometry(feature_));
var newPolyline = Geometry(feature_);
var countInsert = 0;
for (var i in inflowStreams) {
    var info = inflowStreams[i];
    newPolyline = insertVertex(newPolyline, info['startVertex'], info['mBeforeVertex']);
    countInsert += 1;
}
/*if (Count(inflowStreams) &amp;gt; 0) {
}*/
return {
        "result": newPolyline,
        'edit': [{
            'className': 'AGIS_410_Dev.GEWIA.arcade_log',
            'adds': [{
                'attributes': {
                    'value': "Count Inserted Vertices: " + countInsert
                }
            }]
        }]
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 06:51:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1271804#M775</guid>
      <dc:creator>Zoggo</dc:creator>
      <dc:date>2023-03-27T06:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1271900#M777</link>
      <description>&lt;P&gt;Could you share a repo dataset?&amp;nbsp; I am not able to reproduce it on my dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 13:54:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1271900#M777</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-03-27T13:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1272920#M778</link>
      <description>&lt;P&gt;I put the datasets in fgdb but I use this data in a enterprise geodatabase and do the validation and calculations with a service.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 06:21:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1272920#M778</guid>
      <dc:creator>Zoggo</dc:creator>
      <dc:date>2023-03-29T06:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1272971#M779</link>
      <description>&lt;P&gt;I am not sure, the test in a FGDB work fine.&amp;nbsp; I can stage a EGDB and services later to test.&amp;nbsp; I think tech support is the best avenue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeMillerGIS_0-1680088353335.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/66639i095E67AE17EE392D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeMillerGIS_0-1680088353335.png" alt="MikeMillerGIS_0-1680088353335.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:12:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1272971#M779</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-03-29T11:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1272972#M780</link>
      <description>&lt;P&gt;Can you make a pop up out of the rule and see what that returns?&amp;nbsp; You will have to swap the $FeatureSet to a FeatureSetByName($datastore,'Hydro..).&amp;nbsp; I am wondering if there is a time out issue going on.&amp;nbsp; You said you are in services.&amp;nbsp; Could that call to build the FS be doing to much.&amp;nbsp; Can you run fiddler?&amp;nbsp; Do you have Exclude from application evaluation checked for this rule?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:15:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1272972#M780</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-03-29T11:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1273009#M781</link>
      <description>&lt;P&gt;Hi Mike&lt;/P&gt;&lt;P&gt;I get this error already during code check:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zoggo_0-1680094558351.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/66647iA7F782C5C97AB470/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zoggo_0-1680094558351.png" alt="Zoggo_0-1680094558351.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I can't ran the validation and check with fiddler.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:56:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1273009#M781</guid>
      <dc:creator>Zoggo</dc:creator>
      <dc:date>2023-03-29T12:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1273935#M785</link>
      <description>&lt;P&gt;I was able to repo with simpler code, but only a dev machine in postgres.&amp;nbsp; I cannot repo it on another machine.&amp;nbsp; I am unsure what is going on.&amp;nbsp; Tech support would be the best avenue.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeMillerGIS_0-1680223779327.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/66894i588B1BD2F424AB30/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeMillerGIS_0-1680223779327.png" alt="MikeMillerGIS_0-1680223779327.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 00:49:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1273935#M785</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-03-31T00:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule not working anymore  in 3.1</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1287323#M890</link>
      <description>&lt;P&gt;This bug will be addressed in 3.1.2&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use&amp;nbsp;BUG-000157390 for tracking.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 16:33:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-not-working-anymore-in-3-1/m-p/1287323#M890</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2023-05-09T16:33:02Z</dc:date>
    </item>
  </channel>
</rss>

