<?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 Attribute Rule - Generate ID in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322429#M72453</link>
    <description>&lt;P&gt;In the old Desktop Attribute Assistant, you could create multiple rules:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Create a rule to generate incremental sequential IDs (Max + 1) based on the last generated ID (the generated ID starts at 1000).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;Copies a series of values from the nearest feature in a specified layer.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In the screenshot, you can see how the rules are defined in ArcMap/Attribute Assistant. I've tried several codes in Attribute Rule without success. How can I achieve these actions in ArcGIS Pro?"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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="RMR_0-1692950213423.png" style="width: 820px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79120i198739E93C40EB59/image-dimensions/820x87?v=v2" width="820" height="87" role="button" title="RMR_0-1692950213423.png" alt="RMR_0-1692950213423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2023 08:22:35 GMT</pubDate>
    <dc:creator>RMR</dc:creator>
    <dc:date>2023-08-25T08:22:35Z</dc:date>
    <item>
      <title>Attribute Rule - Generate ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322429#M72453</link>
      <description>&lt;P&gt;In the old Desktop Attribute Assistant, you could create multiple rules:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Create a rule to generate incremental sequential IDs (Max + 1) based on the last generated ID (the generated ID starts at 1000).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;Copies a series of values from the nearest feature in a specified layer.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In the screenshot, you can see how the rules are defined in ArcMap/Attribute Assistant. I've tried several codes in Attribute Rule without success. How can I achieve these actions in ArcGIS Pro?"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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="RMR_0-1692950213423.png" style="width: 820px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79120i198739E93C40EB59/image-dimensions/820x87?v=v2" width="820" height="87" role="button" title="RMR_0-1692950213423.png" alt="RMR_0-1692950213423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 08:22:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322429#M72453</guid>
      <dc:creator>RMR</dc:creator>
      <dc:date>2023-08-25T08:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Generate ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322439#M72455</link>
      <description>&lt;P&gt;For the IDs, see my answer in this question:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/using-attribute-rules-to-create-sequential-id/m-p/1320130" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-questions/using-attribute-rules-to-create-sequential-id/m-p/1320130&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For returning the nearest feature's attributes, you could do something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule
// field: empty!
// triggers: Insert, update

var other_fc = FeaturesetByName($datastore, "Etages")
var search_dist = 1000

// get all features in other_fc within search distance
var other_near = Intersects(other_fc, Buffer($feature, search_dist))

// find the nearest
var min_dist = search_distance
var other_nearest = null
for(var f in other_near) {
  var dist = Distance($feature, f)
  if(dist &amp;lt; min_dist) {
    other_nearest = f
    min_dist = dist
  }
}
// abort if no feature was found in the search distance
if(other_nearest == null) { return }

// copy the attributes
return {
  attributes: {
    EtaID: EtaID,
    EtaCode: EtaCode,
    NivCode: NivCode,
    }
  }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 25 Aug 2023 09:33:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322439#M72455</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-25T09:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Generate ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322468#M72464</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, I would like to thank you for responding to my request so quickly and for the solution provided. I have encountered an issue with this code on my map, as it doesn't seem to recognize the "Etages" layer. Could you please let me know the possible reason for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RMR_0-1692962290183.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79130i2237BE369CB6A6FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RMR_0-1692962290183.png" alt="RMR_0-1692962290183.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RMR_1-1692962333682.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79131i04EDA88230AEB343/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RMR_1-1692962333682.png" alt="RMR_1-1692962333682.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 11:26:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322468#M72464</guid>
      <dc:creator>RMR</dc:creator>
      <dc:date>2023-08-25T11:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Generate ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322471#M72465</link>
      <description>&lt;P&gt;Attribute Rules don't work with layers in maps, they work with featureclasses/tables in the same database.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Etages has to be in the same database as the fc where you are implementing the rule&lt;/LI&gt;&lt;LI&gt;If the name is different, change it in the expression&lt;/LI&gt;&lt;LI&gt;If you are working in an Enterprise database (.sde), change the name to the full name: DatabaseName.DataOwner.TableName&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 25 Aug 2023 11:43:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-generate-id/m-p/1322471#M72465</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-25T11:43:14Z</dc:date>
    </item>
  </channel>
</rss>

