<?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 in Arc GIS Pro in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278731#M67988</link>
    <description>&lt;P&gt;I've created a new table &amp;amp; the model imports the attribute rule that was exported from the old table but get an error now saying that it can't execute the calculation as that old table doesn't exist anymore however it's not referenced anywhere in the python code or model?&lt;/P&gt;&lt;P&gt;Do I need to create an attribute rule in this new table for it to work?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="6.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68017i711E4C5CB5FDA2B6/image-size/large?v=v2&amp;amp;px=999" role="button" title="6.JPG" alt="6.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Apr 2023 12:52:28 GMT</pubDate>
    <dc:creator>AndrewReynoldsDevon</dc:creator>
    <dc:date>2023-04-14T12:52:28Z</dc:date>
    <item>
      <title>Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278291#M67931</link>
      <description>&lt;P&gt;I need to do a 4 spatial queries against different polygon features. The 4 polygon features all have the same field name of 'Name' but the field in the point feature is as such, Ward, Parish, County &amp;amp; District.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For attribute rules to work like this do the tables need to be joined?&lt;/P&gt;&lt;P&gt;I'd like to do start with an immediate calculation rule so that when a point is created 4 spatial queries are done at the same time but then once is working I need to use the batch feature &amp;amp; apply these rules to 2 million items of data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The spatial rule will need to be something like which polygon feature does this point exist in?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 15:02:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278291#M67931</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-13T15:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278302#M67937</link>
      <description>&lt;P&gt;The rule could be something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on the point fc
// field: leave empty!
// triggers: insert, update

// load the different polygons into a dictionary where the point fc field names are the keys
var featuresets = {
    "Ward": FeaturesetByName($datastore, "Wards", ["Name"], false),
    "Parish": FeaturesetByName($datastore, "Parishes", ["Name"], false),
    "County": FeaturesetByName($datastore, "Counties", ["Name"], false),
    "District": FeaturesetByName($datastore, "Districts", ["Name"], false),
}

// create the result dictionary
var result = {attributes: {}}

for(var field in featuresets) {
    // get the first intersecting polygon
    var fs = featuresets[field]
    var i_fs = First(Intersects(fs, $feature))
    // get its name (or null if there is no intersecting polygon)
    var name = IIf(i_fs == null, null, i_fs.Name)
    // append to the result
    result.attributes[field] = name
}

// return the result
return {result: result}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It might be better to check the "Exclude from application evaluation" checkbox. This way, only the database executes the rule, not your application (eg ArcGIS Pro). This should make huge bulk updates faster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To trigger this rule for each feature, use the field calculator to calculate any field to be the value that is already in there.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 15:20:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278302#M67937</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-13T15:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278310#M67938</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the speedy reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As per the snips I'm getting an error saying I need to add global ID's. Is this a pre req to using attribute rules?&lt;/P&gt;&lt;P&gt;Also am I adding this code 4 times but tweaking it for each field or do I leave the field drop down blank?&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea of fast automation sounds exciting however I need to get this working on an immediate calculation rule then go from there.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 15:34:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278310#M67938</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-13T15:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278312#M67940</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;As per the snips I'm getting an error saying I need to add global ID's. Is this a pre req to using attribute rules?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Yes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Also am I adding this code 4 times but tweaking it for each field or do I leave the field drop down blank?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Leave it blank.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 15:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278312#M67940</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-13T15:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278314#M67941</link>
      <description>&lt;P&gt;Ideal - have got it working for new items created &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So this is the next challenge - adding Global ID's to 2 million items, adding 4 fields to the table then running the code. I'm thinking of using model builder. If I check 'exclude from app...' would the above workflow work or would it only run as a script? I'd ideally like to let it run overnight then come back &amp;amp; it's all done &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 15:43:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278314#M67941</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-13T15:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278351#M67949</link>
      <description>&lt;P&gt;You could just run a little Python script in the ArcGIS Pro Python window:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# path to your point fc
fc = "C:/data/my_database.gdb/Points"

# add GlobalIDs
arcpy.management.AddGlobalIDs(fc)

# add fields
arcpy.management.AddField(fc, "Ward", "TEXT")
arcpy.management.AddField(fc, "Parish", "TEXT")
arcpy.management.AddField(fc, "County", "TEXT")
arcpy.management.AddField(fc, "District", "TEXT")

# trigger updates
arcpy.management.CalculateField(fc, "Ward", "null", "ARCADE")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Apr 2023 16:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278351#M67949</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-13T16:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278659#M67973</link>
      <description>&lt;P&gt;Regarding the filepath of the point fc -this is stored in an geodatabase so in the python does it need to refer to the manager connection to the geodb? then after that the location of the item?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 07:42:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278659#M67973</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-14T07:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278662#M67974</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fc = "C:/bla/database_connection.sde/Points"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 07:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278662#M67974</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-14T07:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278668#M67975</link>
      <description>&lt;P&gt;I'm testing the functionality of the applying the attribute rule to existing features. I launched the Calculate Field from the geoprocessing tools in Pro however it wants a specific field name see snip. The code in the Attribute rule editor allows the field name to be blank.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.JPG" style="width: 390px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/67998i2A06308D83479932/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.JPG" alt="3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 08:41:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278668#M67975</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-14T08:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278673#M67976</link>
      <description>&lt;P&gt;Yeah, you can't just take that expression and use it in the field calculator. The Attribute Rule calculates multiple fields at once, you can't do that in the calculator.&lt;/P&gt;&lt;P&gt;To apply the rule on an existing feature:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;create the rule, be sure that it triggers on update&lt;/LI&gt;&lt;LI&gt;make any edit to the feature&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For bulk updates, just use the field calculator to update a field (let's call it Field1) to the value that is alread in that field:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Field1 = 
return $feature.Field1&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 09:19:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278673#M67976</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-14T09:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278681#M67977</link>
      <description>&lt;P&gt;I've tried using the code earlier to create the 4 fields however I'm getting the below error&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="4.JPG" style="width: 780px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68001iAA7FE7F668A44C70/image-size/large?v=v2&amp;amp;px=999" role="button" title="4.JPG" alt="4.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 09:31:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278681#M67977</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-14T09:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278689#M67981</link>
      <description>&lt;P&gt;I've used Model Builder to add the 4 fields successfully &amp;amp; to import the attribute rule to the point FC.&lt;/P&gt;&lt;P&gt;The next hurdle is the code you use below to trigger the updates. It works in python but what do I need to enter into the 'Parish= ' calculation box?&lt;/P&gt;&lt;PRE&gt;arcpy.management.CalculateField(fc, "Ward", "null", "ARCADE")&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68004i480609DB040F0578/image-size/large?v=v2&amp;amp;px=999" role="button" title="5.JPG" alt="5.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 10:07:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278689#M67981</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-14T10:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278706#M67983</link>
      <description>&lt;P&gt;You forgot the path to the database.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fc = "path:/to/your/database.sde/CorGIS.CORMGR.Blablabla"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 11:37:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278706#M67983</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-14T11:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278707#M67984</link>
      <description>&lt;P&gt;Literally anything. You just want to trigger the Attribute Rule, and the rule will calculate a new value for the Parish field.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//Parish = 
"abc"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 11:39:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278707#M67984</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-14T11:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278731#M67988</link>
      <description>&lt;P&gt;I've created a new table &amp;amp; the model imports the attribute rule that was exported from the old table but get an error now saying that it can't execute the calculation as that old table doesn't exist anymore however it's not referenced anywhere in the python code or model?&lt;/P&gt;&lt;P&gt;Do I need to create an attribute rule in this new table for it to work?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="6.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68017i711E4C5CB5FDA2B6/image-size/large?v=v2&amp;amp;px=999" role="button" title="6.JPG" alt="6.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 12:52:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278731#M67988</guid>
      <dc:creator>AndrewReynoldsDevon</dc:creator>
      <dc:date>2023-04-14T12:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rules in Arc GIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278760#M67989</link>
      <description>&lt;P&gt;That's the same error as in your previous reply. Did you actually change the fc path to include the databas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 13:35:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-in-arc-gis-pro/m-p/1278760#M67989</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-14T13:35:43Z</dc:date>
    </item>
  </channel>
</rss>

