<?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 Rules Error When Inserting New Row in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1207145#M65422</link>
    <description>&lt;P&gt;According to the error message, your new point doesn't intersect any features in "B_DSD_District". So you should probably take a look at your Python script and correct that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, you can change the Attribute rule, so that it doesn't return an error when that happens:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var featureSet = FeatureSetByName($datastore,'B_DSD_District', ['DIV'], true);
var featureSet2 = Intersects(featureSet, Geometry($feature))
var result = First(featureSet2)
if(result==null)
return null  // return no value instead of an error
else
return result.DIV&lt;/LI-CODE&gt;&lt;P&gt;This might break some of your workflows if it is important that this field is filled!&lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2022 10:28:52 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-08-29T10:28:52Z</dc:date>
    <item>
      <title>Attribute Rules Error When Inserting New Row</title>
      <link>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1207129#M65420</link>
      <description>&lt;P&gt;I am writing a script to create a junction point in a utility network with attribute rules. But when I ran the execute, the following error is shown:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "CreatePolygonCentroid.py", line 76, in &amp;lt;module&amp;gt;&lt;BR /&gt;junCur.insertRow(insRow)&lt;BR /&gt;RuntimeError: Arcade script raised an error. [&lt;BR /&gt;Rule name: Division,&lt;BR /&gt;Triggering event: Insert,&lt;BR /&gt;Class name: StormwaterJunction,&lt;BR /&gt;GlobalID: {48BEB490-EF59-4756-818A-BDB41DD071E0},&lt;BR /&gt;Script error: result = null]&lt;BR /&gt;&lt;BR /&gt;And below is the "Division" rule:&lt;/P&gt;&lt;P&gt;var featureSet = FeatureSetByName($datastore,'B_DSD_District', ['DIV'], true);&lt;BR /&gt;var featureSet2 = Intersects(featureSet, Geometry($feature))&lt;BR /&gt;var result = First(featureSet2)&lt;BR /&gt;if(result==null)&lt;BR /&gt;return {"errorMessage": "result = null"}&lt;BR /&gt;else&lt;BR /&gt;return result.DIV&lt;BR /&gt;&lt;BR /&gt;How can I create the junction by script without disabling the attribute rules?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 09:31:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1207129#M65420</guid>
      <dc:creator>MatsHardy</dc:creator>
      <dc:date>2022-08-29T09:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rules Error When Inserting New Row</title>
      <link>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1207145#M65422</link>
      <description>&lt;P&gt;According to the error message, your new point doesn't intersect any features in "B_DSD_District". So you should probably take a look at your Python script and correct that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, you can change the Attribute rule, so that it doesn't return an error when that happens:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var featureSet = FeatureSetByName($datastore,'B_DSD_District', ['DIV'], true);
var featureSet2 = Intersects(featureSet, Geometry($feature))
var result = First(featureSet2)
if(result==null)
return null  // return no value instead of an error
else
return result.DIV&lt;/LI-CODE&gt;&lt;P&gt;This might break some of your workflows if it is important that this field is filled!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 10:28:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1207145#M65422</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-08-29T10:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rules Error When Inserting New Row</title>
      <link>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1209549#M65485</link>
      <description>&lt;P&gt;Thanks for your help, I have checked the file gdb, the feature class B_DSD_District exists in the gdb. Besides, the junction point should intersect with one of the polygons in B_DSD_District. How can I resolve the problem?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 06:14:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1209549#M65485</guid>
      <dc:creator>MatsHardy</dc:creator>
      <dc:date>2022-09-04T06:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rules Error When Inserting New Row</title>
      <link>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1209621#M65487</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Besides, the junction point should intersect with one of the polygons in B_DSD_District&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Well, the Attribute Rule throws an error because the point does not intersect a polygon in the feature class.&lt;/P&gt;&lt;P&gt;So, you have two possibilities:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;change the Attribute Rule, using the expression I posted above&lt;/LI&gt;&lt;LI&gt;change your script, so that it inserts valid points&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get more meaningful help, you would have to post your script.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1662363141093.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/50445iA07E081116B51CA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1662363141093.png" alt="JohannesLindner_0-1662363141093.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_1-1662363160899.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/50446i1A0C71034BB9FD27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1662363160899.png" alt="JohannesLindner_1-1662363160899.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 07:32:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-rules-error-when-inserting-new-row/m-p/1209621#M65487</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-09-05T07:32:56Z</dc:date>
    </item>
  </channel>
</rss>

