<?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 Arcade - generating unique IDs for new and existing polygons in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558063#M90082</link>
    <description>&lt;P&gt;I need help with creating a system for generating unique IDs for a layer. Most of the features already have unique IDs in a large numeric range, and all of them begin with the letter "P" (e.g., P10057). This setup was done prior to me. I need to keep it the same as the layer is tied to a related table(s) with that ID.&lt;/P&gt;&lt;P&gt;What I'm looking for is a solution that will automatically generate a unique ID for each new feature created, ensuring that the ID is not already in use. Additionally, I have about 12 existing polygons that were created without IDs, and I need help assigning unique IDs to those as well.&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="Laura_0-1731511653423.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119402iDA0F956F029C4561/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Laura_0-1731511653423.png" alt="Laura_0-1731511653423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated, thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2024 16:12:28 GMT</pubDate>
    <dc:creator>Laura</dc:creator>
    <dc:date>2024-11-13T16:12:28Z</dc:date>
    <item>
      <title>Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558063#M90082</link>
      <description>&lt;P&gt;I need help with creating a system for generating unique IDs for a layer. Most of the features already have unique IDs in a large numeric range, and all of them begin with the letter "P" (e.g., P10057). This setup was done prior to me. I need to keep it the same as the layer is tied to a related table(s) with that ID.&lt;/P&gt;&lt;P&gt;What I'm looking for is a solution that will automatically generate a unique ID for each new feature created, ensuring that the ID is not already in use. Additionally, I have about 12 existing polygons that were created without IDs, and I need help assigning unique IDs to those as well.&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="Laura_0-1731511653423.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119402iDA0F956F029C4561/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Laura_0-1731511653423.png" alt="Laura_0-1731511653423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 16:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558063#M90082</guid>
      <dc:creator>Laura</dc:creator>
      <dc:date>2024-11-13T16:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558075#M90083</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/578538"&gt;@Laura&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the only way to do this, because you are using alpha numeric values instead of numerical values, is you would need to loop through the entire feature set, removing the p from each value to get the number, and then populate a list of numbers and only returning the maximum number. From there you would simply add 1 to the max and return that number as the new id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = $featureset

var Numbers = []
for( var row in fs ){
    var id = row['&amp;lt;insert id field name&amp;gt;']
    id = Left( id , Count( id ) - 1 )
    Push( Numbers , id )
    }
var N = Max( Numbers ) + 1
return 'P'+Text( N )&lt;/LI-CODE&gt;&lt;P&gt;It is typically recommended to use numerical values for ids unless there isn't another option or because it is used because of some other application/dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 15:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558075#M90083</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2024-11-13T15:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558169#M90092</link>
      <description>&lt;P&gt;Am I not filling something in here?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Laura_0-1731520244176.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119426iCE408D67552963AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Laura_0-1731520244176.png" alt="Laura_0-1731520244176.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 17:50:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558169#M90092</guid>
      <dc:creator>Laura</dc:creator>
      <dc:date>2024-11-13T17:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558219#M90096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/578538"&gt;@Laura&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You simply added the feature value. Delete '$feature.' and it should work.&lt;/P&gt;&lt;P&gt;I also forgot to include this in the script.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    id = Number( Left( id , Count( id ) - 1 ) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Did you select arcade as the calculation method?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 19:06:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558219#M90096</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2024-11-13T19:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558253#M90099</link>
      <description>&lt;P&gt;Yes, arcade.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Laura_0-1731526596385.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119443i9E228F53DE3A2094/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Laura_0-1731526596385.png" alt="Laura_0-1731526596385.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 19:36:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558253#M90099</guid>
      <dc:creator>Laura</dc:creator>
      <dc:date>2024-11-13T19:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558282#M90102</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/578538"&gt;@Laura&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Try changing the $featureset to just $feature and see how that works.&lt;/P&gt;&lt;P&gt;What you could do is take the highest value in the list and then add the object id to create the unique number and then convert that to text and add 'P' at the beginning.&lt;/P&gt;&lt;P&gt;Unfortunately, alpha-numeric ids are really difficult to work with because of the fluctuations in values.&lt;/P&gt;&lt;P&gt;The code snippet above does work, but it would mostly work with attribute rules.&lt;/P&gt;&lt;P&gt;If you truly need something akin to that, then my only other suggestion would be to create an attribute rule, similar to how the field calculation is set up, and then try running a nonchalant calculation to trigger the rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 20:11:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558282#M90102</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2024-11-13T20:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558745#M90153</link>
      <description>&lt;P&gt;Still throwing error, I called support and will see what they come up with.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1558745#M90153</guid>
      <dc:creator>Laura</dc:creator>
      <dc:date>2024-11-14T17:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - generating unique IDs for new and existing polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1575134#M91903</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/578538"&gt;@Laura&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I failed to realize that the code that I sent you does not work in terms of field calculations but it will work as an attribute rule. If you create an attribute rule and use the code expression as the one that was sent, and run an arbitrary calculation then it should work.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 21:56:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-generating-unique-ids-for-new-and-existing/m-p/1575134#M91903</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-01-13T21:56:26Z</dc:date>
    </item>
  </channel>
</rss>

