<?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: How to return a Error Geometry for a validation rule in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1271805#M776</link>
    <description>&lt;P&gt;I wrote a calculation rule for fixing this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function findDuplicateVertex(polyline_geometry) {
    var arr = [];
    var vertices = polyline_geometry.paths[0]
    for (var s = 0; s &amp;lt; Count(vertices) - 1; s++) {
        var p0 = vertices[s];
        var p1 = vertices[s + 1];
        if (Intersects(p0, p1)){
            if (s+1 != Count(vertices)-1){
              Push(arr, s + 1);
            } else {
              Push(arr, s);
            }
        }
    }
    return arr
}
function removeDuplicateVertex(polyline_geometry) {
    var dupVertexIndexArray = findDuplicateVertex(polyline_geometry);
    if (Count(dupVertexIndexArray) &amp;gt; 0) {
        var origVerteces = Dictionary(Text(polyline_geometry)).paths[0];
        var reducedVerteces = [];
        for (var s = 0; s &amp;lt; Count(origVerteces) ; s++) {
            if (Includes(dupVertexIndexArray, s) == false) {
                Push(reducedVerteces, origVerteces[s]);
            }
        }
        var newPolyline_geometry = Dictionary(text(polyline_geometry));
        newPolyline_geometry.paths[0] = reducedVerteces;
        return Polyline(newPolyline_geometry)
    } else {
        return
    }
}
// ************* End Functions Section ******************
var feature = $feature
//var feature = First(Filter($featureSet, 'OBJECTID = 495'));
var newPolyline_geometry = removeDuplicateVertex(Geometry(feature));
if (IsEmpty(newPolyline_geometry)) {
    return Geometry($feature)
}
return newPolyline_geometry&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 27 Mar 2023 06:54:01 GMT</pubDate>
    <dc:creator>Zoggo</dc:creator>
    <dc:date>2023-03-27T06:54:01Z</dc:date>
    <item>
      <title>How to return a Error Geometry for a validation rule</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1180517#M435</link>
      <description>&lt;P&gt;I'm writing a validation rule for detecting duplicate vertex in a polyline. When I find a duplicate vertex I like to write the location (point) of the duplicate vertex as an error in the GDB_ValidationPointErrors feature class therefore I can find it afterwards in the Error Inspector. How can I return or write the error point geometry in the validation rule?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 07:21:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1180517#M435</guid>
      <dc:creator>Zoggo</dc:creator>
      <dc:date>2022-06-07T07:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a Error Geometry for a validation rule</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1181014#M440</link>
      <description>&lt;P&gt;Disclaimer: I haven't worked with Validation Rules yet, only Calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AFAIK, you can't directly write from validation rules. You just return true or false and ArcGIS creates the error feature automatically, in your case that would be a polygon.&lt;/P&gt;&lt;P&gt;Of course, telling your editors that there's a duplicate vertex, but not which of the 1000's of vertices is not really helpful...&lt;/P&gt;&lt;P&gt;You could try adding points to the point error class using a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;return dictionary&lt;/A&gt;:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return {
    "result": false,
    "edit": [
        {
            "className": "GDB_ValidationPointErrors",
            "adds": [
                {"geometry": Geometry($feature).rings[0][0]}
                ]
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;I don't think that will work though, as these feature classes are special and thus probably protected. You could also try to create a new point feature class and add the duplicate vertices to that fc. That could work, but your editors would have to manually remove the points when they are finished correcting the feature.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 12:56:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1181014#M440</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-06-08T12:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a Error Geometry for a validation rule</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1261832#M740</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/485664"&gt;@Zoggo&lt;/a&gt;&amp;nbsp;how did you manage this?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2023 10:25:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1261832#M740</guid>
      <dc:creator>Ranga_Tolapi</dc:creator>
      <dc:date>2023-02-26T10:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a Error Geometry for a validation rule</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1271805#M776</link>
      <description>&lt;P&gt;I wrote a calculation rule for fixing this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function findDuplicateVertex(polyline_geometry) {
    var arr = [];
    var vertices = polyline_geometry.paths[0]
    for (var s = 0; s &amp;lt; Count(vertices) - 1; s++) {
        var p0 = vertices[s];
        var p1 = vertices[s + 1];
        if (Intersects(p0, p1)){
            if (s+1 != Count(vertices)-1){
              Push(arr, s + 1);
            } else {
              Push(arr, s);
            }
        }
    }
    return arr
}
function removeDuplicateVertex(polyline_geometry) {
    var dupVertexIndexArray = findDuplicateVertex(polyline_geometry);
    if (Count(dupVertexIndexArray) &amp;gt; 0) {
        var origVerteces = Dictionary(Text(polyline_geometry)).paths[0];
        var reducedVerteces = [];
        for (var s = 0; s &amp;lt; Count(origVerteces) ; s++) {
            if (Includes(dupVertexIndexArray, s) == false) {
                Push(reducedVerteces, origVerteces[s]);
            }
        }
        var newPolyline_geometry = Dictionary(text(polyline_geometry));
        newPolyline_geometry.paths[0] = reducedVerteces;
        return Polyline(newPolyline_geometry)
    } else {
        return
    }
}
// ************* End Functions Section ******************
var feature = $feature
//var feature = First(Filter($featureSet, 'OBJECTID = 495'));
var newPolyline_geometry = removeDuplicateVertex(Geometry(feature));
if (IsEmpty(newPolyline_geometry)) {
    return Geometry($feature)
}
return newPolyline_geometry&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Mar 2023 06:54:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-return-a-error-geometry-for-a-validation/m-p/1271805#M776</guid>
      <dc:creator>Zoggo</dc:creator>
      <dc:date>2023-03-27T06:54:01Z</dc:date>
    </item>
  </channel>
</rss>

