<?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 Autonumber in Pro when feature is created in Arcade in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190520#M8432</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;I am trying to create an attribute rule in ArcGIS Pro that creates an ID for the feature when it is created as well as choose features with '::' leading the ID and assign a new unique ID. There seems to be an issue with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: var(--black-075); border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;NextSequenceValue&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;We previously were achieving this with the Generate ID function in a dynamic table.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;Any suggestions are appreciated. So far I am unsuccessful but here is my code:&lt;/P&gt;&lt;PRE style="background-color: var(--black-050); border: 0px; margin: 0px 0px 1em; padding: 12px 8px;"&gt;&lt;CODE style="background-color: transparent; border: 0px; font-weight: inherit; margin: 0px;"&gt;// This rule will create a new unique id when a road centerline is created // If the road was created from a split its original id will have a prefix of '::' // We will use this to find the original road and its related alias road names  if (Left($feature.CTRLINEID, 2) == "::" || IsEmpty($feature.CTRLINEID)) { var id = NextSequenceValue('CTRLINEID')      // If the centerlineid is not set return the new id if (IsEmpty($feature.CTRLINEID)) return id;   // Find the original ID of the road that was split     var original_id = Mid($feature.centerlineid, 2, Count($feature.centerlineid) - 2);     if (IsEmpty(original_id)) return id;      // Store an add for every road alias and related it to the new road that was added after the cut var newAttributes = {}; newAttributes['CTRLINEID'] = id }&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Aug 2020 17:40:55 GMT</pubDate>
    <dc:creator>CourtneyDunn</dc:creator>
    <dc:date>2020-08-13T17:40:55Z</dc:date>
    <item>
      <title>Autonumber in Pro when feature is created in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190520#M8432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;I am trying to create an attribute rule in ArcGIS Pro that creates an ID for the feature when it is created as well as choose features with '::' leading the ID and assign a new unique ID. There seems to be an issue with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: var(--black-075); border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;NextSequenceValue&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;We previously were achieving this with the Generate ID function in a dynamic table.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;Any suggestions are appreciated. So far I am unsuccessful but here is my code:&lt;/P&gt;&lt;PRE style="background-color: var(--black-050); border: 0px; margin: 0px 0px 1em; padding: 12px 8px;"&gt;&lt;CODE style="background-color: transparent; border: 0px; font-weight: inherit; margin: 0px;"&gt;// This rule will create a new unique id when a road centerline is created // If the road was created from a split its original id will have a prefix of '::' // We will use this to find the original road and its related alias road names  if (Left($feature.CTRLINEID, 2) == "::" || IsEmpty($feature.CTRLINEID)) { var id = NextSequenceValue('CTRLINEID')      // If the centerlineid is not set return the new id if (IsEmpty($feature.CTRLINEID)) return id;   // Find the original ID of the road that was split     var original_id = Mid($feature.centerlineid, 2, Count($feature.centerlineid) - 2);     if (IsEmpty(original_id)) return id;      // Store an add for every road alias and related it to the new road that was added after the cut var newAttributes = {}; newAttributes['CTRLINEID'] = id }&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 17:40:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190520#M8432</guid>
      <dc:creator>CourtneyDunn</dc:creator>
      <dc:date>2020-08-13T17:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber in Pro when feature is created in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190521#M8433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey&amp;nbsp;Courtney,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What problems are you having with NextSequenceValue? that should be the solution to get you to sequence your table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) You need to create a database sequence, using the Create Database Sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/503426_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Create an Attribute Rule&amp;nbsp; and use the NextSequenceValue to get a sequence from the DB and store it in the field, make sure its on Insert&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/503427_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Finally create few features&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/503428_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2020 22:43:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190521#M8433</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2020-08-13T22:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber in Pro when feature is created in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190522#M8434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/154383" target="_blank"&gt;Hussein Nasser&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking at the code shared by&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/416683" target="_blank"&gt;Courtney Dunn&lt;/A&gt;&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// This rule will create a new unique id when a road centerline is created &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// If the road was created from a split its original id will have a prefix of '::' &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// We will use this to find the original road and its related alias road names  &lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Left&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CTRLINEID&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"::"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;||&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CTRLINEID&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; 
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; id &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;NextSequenceValue&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'CTRLINEID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// If the centerlineid is not set return the new id &lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CTRLINEID&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; id&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;   
    &lt;SPAN class="comment token"&gt;// Find the original ID of the road that was split     &lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; original_id &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Mid&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;centerlineid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;centerlineid&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;original_id&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; id&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;      
    &lt;SPAN class="comment token"&gt;// Store an add for every road alias and related it to the new road that was added after the cut &lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; newAttributes &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; 
    newAttributes&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'CTRLINEID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; id&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and I notice&amp;nbsp;that the last part has not been implemented yet (lines 16 and 17). Maybe the idea is to update related features, but that part is missing.&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/416683" target="_blank"&gt;Courtney Dunn&lt;/A&gt;&amp;nbsp;, can you explain what you want to achieve with this last part. Currently it does not do anything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before lines 11 I would check if your centerlineid is not empty. Because if it is, line 11 will fail using the Count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general you have a couple of If statements, but no else. There&amp;nbsp;can be several cases that return no value. Is that what you want?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:35:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190522#M8434</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T09:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber in Pro when feature is created in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190523#M8435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code snippet appears to be from the &lt;A href="https://solutions.arcgis.com/local-government/help/address-data-management/#:~:text=Address%20Data%20Management%20can%20be,addresses%2C%20and%20related%20mailing%20addresses." rel="nofollow noopener noreferrer" target="_blank"&gt;ESRI Address Data Management Solution&lt;/A&gt;&amp;nbsp;and specifically the&amp;nbsp;Centerline ID and Copy Road Aliases&amp;nbsp;rule, shown in it's entirety below.&amp;nbsp; &lt;A href="https://community.esri.com/migrated-users/3100" target="_blank"&gt;Xander Bakker&lt;/A&gt;, lines 16 &amp;amp; 17 above taken out of context are meaningless on their own; line 15 above is line 24 below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that &lt;A href="https://community.esri.com/migrated-users/154383" target="_blank"&gt;Hussein Nasser&lt;/A&gt;‌ has hit the nail on the head.&amp;nbsp; &lt;A href="https://community.esri.com/migrated-users/363822" target="_blank"&gt;Courtney Dunn&lt;/A&gt;‌ have you created the sequence first in you data base?&amp;nbsp; The fgdb that comes with the solution should have it already.&amp;nbsp; You can use the &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/listdatabasesequences.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.da.ListDatabaseSequences()&lt;/A&gt; like this to see what is there.&amp;nbsp; In a python window or the python ide of your choice:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

gdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\path\to\your\geodatabase'&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; s &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDatabaseSequences&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f'Name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;s&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;  StartValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;s&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;startValue&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;  IncrementValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;s&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;incrementValue&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;  CurrentValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;s&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;currentValue&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using an EGDB for your data, the da.ListDatabaseSequences() function isn't available. See&amp;nbsp;&lt;A href="https://community.esri.com/ideas/18798-arcpylistdatabasesequences-for-egdb" target="_blank"&gt;arcpy.ListDatabaseSequences() for EGDB&lt;/A&gt;&amp;nbsp; to vote for it or you can try to use what ESRI Tech Support provided me as a SQL work around which I haven't got to work yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arcade rule below: (looping in &lt;A href="https://community.esri.com/migrated-users/52415" target="_blank"&gt;Chris Fox&lt;/A&gt;‌ too...)&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;// This rule will create a new unique id when a road centerline is created
// This will also copy related road alias names for any roads that were added as a result of a split

// Define the leading text and the delimiter for the ID
var prefix = "RD"
var join_char = "-"

// Define any fields to be copied from the road name aliases table (lower case)
var alias_field_names = ["roadpremod", "roadpredir", "roadpretype", "roadpretypesep", "roadname", "roadtype", "roadpostdir", "roadpostmod", "fullname", "municipality"]

// If the road was created from a split its oirginal id will have a prefix of '::'
// We will use this to find the original road and its related alias road names
if (Left($feature.centerlineid, 2) == "::" || IsEmpty($feature.centerlineid)) {
    var id = Concatenate([prefix, NextSequenceValue("CenterlineID")], join_char)
    
    // If the centerlineid is not set return the new id
    if (IsEmpty($feature.centerlineid)) return id;
   
    // Find the original ID of the road that was split
    var original_id = Mid($feature.centerlineid, 2, Count($feature.centerlineid) - 2);
    if (IsEmpty(original_id)) return id;
    
    // Find all the related road alias names for the split road
    // Store an add for every road alias and related it to the new road that was added after the cut
    var adds = []
    var roadNameAliases = Filter(FeatureSetByName($datastore, "AliasRoadName"), "centerlineid = '" + original_id + "'");
    for (var roadNameAlias in roadNameAliases) {
        var featureAttributes = Dictionary(Text(roadNameAlias))['attributes'];
        var newAttributes = {};
        for (var k in featureAttributes) {
            if (IndexOf(alias_field_names, Lower(k)) &amp;gt; -1 &amp;amp;&amp;amp; featureAttributes&lt;K&gt; != null) {
                newAttributes&lt;K&gt; = featureAttributes&lt;K&gt;;
            } else {
                continue;
            }
        }
        newAttributes['centerlineid'] = id
        adds[Count(adds)] = {
            'attributes': newAttributes
        }
    }
    
    // Using the edit parameter return the list of updates and adds for the intersecting roads and a list of adds for related road alias names
    return {
        'result': id,
        'edit': [{'className': 'AliasRoadName', 'adds': adds}]
    };
}
else {
   return $feature.centerlineid
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190523#M8435</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T09:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Autonumber in Pro when feature is created in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190524#M8436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is some more content (video form) on generating unique id&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/videos/6803"&gt; Video Link : 6803&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2020 22:22:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/autonumber-in-pro-when-feature-is-created-in/m-p/190524#M8436</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2020-09-18T22:22:59Z</dc:date>
    </item>
  </channel>
</rss>

