<?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: Check for Duplicate AssetID Values with Arcade in Electric Questions</title>
    <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209834#M177</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/383982" target="_blank"&gt;Billy Guerrero&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can imagine that changing from paper maps to the Utility Network is a huge leap in digital transformation and will requiere proper change management for those&amp;nbsp;that will interact with the UN. However, the benefits that you will have as organization are priceless. How far are you in the process of implementing the UN?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just looked at the 2nd expression&amp;nbsp;you shared and there are a couple of questions and comments I have:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I see that you check at the end if the&amp;nbsp;ID is not already set. You might want to do this at the start to avoid processing when it is not necessary&lt;/LI&gt;&lt;LI&gt;This also makes me wonder. What trigger did you define fro this attribute rule? If it is also trigger on update, and a point is moved to another area, the code would change, no only the prefix but also the distance.&amp;nbsp;If you update the code based on these new aspects, you might create a hole in the sequence. Update triggers will need a different way of processing and some considerations of what you want to happen. I have a blog (in Spanish, sorry) of how this could be handled here:&amp;nbsp;&lt;A href="https://community.esri.com/docs/DOC-14703" target="_blank"&gt;CRU2020 - Track Servicios Públicos - Arcade y Reglas de Atributos&lt;/A&gt;&amp;nbsp;(although it uses database sequences)&lt;/LI&gt;&lt;LI&gt;I also notice that the format of the id has changed. You seem to increment the distance when a distance is "already in use". Is that correct? I thought that you were creating a postfix that will increment based on the number of&amp;nbsp;id's that are already in use.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I ignore&amp;nbsp;an updates and changes in distance and the prefix, I would think that the logic could be something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// check first if the id is already set&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; prefix &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"W"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// assumably is extracted from a polygon fs&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; dist_feet &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;551&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// dist_degree(...);&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fsPolesRules &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByName&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;&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; idcode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; prefix &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dist_feet&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'00000'&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;// create a sql to query all features withe the same start of the assetid&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"assetid LIKE '"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; idcode &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"%'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// filter the fs&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs_filtered &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Filter&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsPolesRules&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sql&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// use the count to create a new code&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs_filtered&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
idcode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; prefix &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dist_feet&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'00000'&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;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&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;// this will gloriously fail when existing points get moved &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// and the id is adjusted to those changes&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// return the result&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:20:41 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-11T10:20:41Z</dc:date>
    <item>
      <title>Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209831#M174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an Arcade rule that generates an assetid when a point is inserted. This code is generated by measuring and rounding the distance, in feet, of the inserted point feature from a fix reference point. The process could generate repeated assetids for point features that are located at the same distance from the reference point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore, I'm trying to compare the new assetid with the existing ones using 2 for loops, with the code shown below.&lt;/P&gt;&lt;P&gt;The code tries to compare the new assetid against all the existing (inner loop), if there is a duplicate then change the new assetid, compare again, and if there is no duplicate then exit the outer loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The rule is not work. It never enters the if statement inside the inner loop, see code below. I purposely created duplicate assetids, as you can see in the pic below. Tried adding a point and saving the edit, then adding another one and saving again, in case the Arcade rule was not seeing the repeated assetid until the edits have been saved; but that didn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something wrong on the code or there is a better and more efficient way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" height="454" src="https://community.esri.com/legacyfs/online/493804_pastedImage_2.png" width="678" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="543" src="https://community.esri.com/legacyfs/online/493803_pastedImage_1.png" width="623" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 18:35:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209831#M174</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2020-05-28T18:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209832#M175</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/383982"&gt;Billy Guerrero&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wondering, but why are you generating an assetid based on the distance in feet from a fixed point? Normally, when automatically creating an assetid, the recommendation is using the&amp;nbsp;NextSequenceValue function in combination with a sequence defined in the database (&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/create-database-sequence.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/create-database-sequence.htm"&gt;Create Database Sequence—Data Management toolbox | Documentation&lt;/A&gt;&amp;nbsp;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also only showed part of the expression and I did not see any part where you return a value. Also, when the data volume starts growing, looping through the entire data&amp;nbsp;will have an impact on&amp;nbsp;performance. If you do need to use the distance for the assetid, use a filter first to only filter those that start with the same id and use the count to generate the new id and not a for loop. Also when there are 10 or more&amp;nbsp;points at the same distance you will run into duplicate codes again with your code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 13:05:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209832#M175</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-29T13:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209833#M176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we were reviewing the different ways to create an assetid we tested the NextSequenceValue option, but we want to have an assetid code that would have some meaning, not just any random number. Our new assetid code has the information about the district where the asset it located and the distance from a reference point. Maybe you would wonder why someone would need that since you can get that information from the map, but when you are jumping from paper maps to digital maps with the utility network, this king of transition is not easy for everybody. Our current assetid system for poles is not database friendly (a lot of duplicate numbers) but it's very intuitive for the people in the field. With our implementation of the utility network we decided to change our current assetid system, but we want to replace it with something that will convey some information for the people in the field when they are not using the digital map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I share your concern about performance with the nested for-loops and growing data volume, that's why I was wondering if there was another method. Right now we have less than 10K poles, but we don't expect that that number will increase beyond 10K. Yesterday, I came to the same conclusion that you are suggesting and this is the new rule:&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/493875_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The rule performance, in the test environment, with the ~10K poles on the map is almost the same that we experience when the rule was not checking for duplicate values, so it looks like performance won't be an issue. But we still have to test it in the production environment, where we are adding the poles with a group template that includes other features (lines, electric attachment and street lights)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the assetid generated by the rule includes a "prefix" (pole district), I'm thinking that maybe filtering the pole class by the "prefix", to reduce the dataset being tested for duplicates, could make the rule more efficient. What do you think? Also, I still wonder why the first rule didn't work, even if it's not very efficient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 14:32:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209833#M176</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2020-05-29T14:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209834#M177</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/383982" target="_blank"&gt;Billy Guerrero&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can imagine that changing from paper maps to the Utility Network is a huge leap in digital transformation and will requiere proper change management for those&amp;nbsp;that will interact with the UN. However, the benefits that you will have as organization are priceless. How far are you in the process of implementing the UN?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just looked at the 2nd expression&amp;nbsp;you shared and there are a couple of questions and comments I have:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I see that you check at the end if the&amp;nbsp;ID is not already set. You might want to do this at the start to avoid processing when it is not necessary&lt;/LI&gt;&lt;LI&gt;This also makes me wonder. What trigger did you define fro this attribute rule? If it is also trigger on update, and a point is moved to another area, the code would change, no only the prefix but also the distance.&amp;nbsp;If you update the code based on these new aspects, you might create a hole in the sequence. Update triggers will need a different way of processing and some considerations of what you want to happen. I have a blog (in Spanish, sorry) of how this could be handled here:&amp;nbsp;&lt;A href="https://community.esri.com/docs/DOC-14703" target="_blank"&gt;CRU2020 - Track Servicios Públicos - Arcade y Reglas de Atributos&lt;/A&gt;&amp;nbsp;(although it uses database sequences)&lt;/LI&gt;&lt;LI&gt;I also notice that the format of the id has changed. You seem to increment the distance when a distance is "already in use". Is that correct? I thought that you were creating a postfix that will increment based on the number of&amp;nbsp;id's that are already in use.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I ignore&amp;nbsp;an updates and changes in distance and the prefix, I would think that the logic could be something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// check first if the id is already set&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; prefix &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"W"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// assumably is extracted from a polygon fs&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; dist_feet &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;551&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// dist_degree(...);&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fsPolesRules &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByName&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;&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; idcode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; prefix &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dist_feet&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'00000'&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;// create a sql to query all features withe the same start of the assetid&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"assetid LIKE '"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; idcode &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"%'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// filter the fs&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs_filtered &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Filter&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsPolesRules&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sql&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// use the count to create a new code&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs_filtered&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
idcode &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; prefix &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dist_feet&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'00000'&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;Text&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&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;// this will gloriously fail when existing points get moved &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// and the id is adjusted to those changes&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// return the result&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:20:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209834#M177</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T10:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209835#M178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you mentioned, we agree that the benefits of the UN worth the effort. At this point, we have created our data dictionary, selected the Tiers, AG/AT (AssetGroup/AssetType), and related tables that we need. Also, we deployed the Electric Utility Network asset package with the sample data (as a testing environment) and deployed the same asset package with the schema only and the special reference changed to our location (our project environment). Since we don't have GIS quality data to import directly to the UN, we have to basically draw the network one pole at a time, with the help of group and preset templates. But we have decided to start by creating all the substations, then the interconnecting lines between them, and finally the distribution circuits and the other assets (transformers, junction box, street lights, etc) Also we're are taking our time to clean and transform the data that will be added to the UN, which will be added to the features using Arcade rules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your comments and suggestions. Here are my comments:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Your first point is very valid. I'll adjust the script accordingly.&lt;/LI&gt;&lt;LI&gt;For you second point, the rule is triggered by insertion. The type of assets (poles, junction box and hanholes) that will be using this rule to generate their assetid are not usually moved, so they will have that number until they are removed from the field. In reality, this id is acting more as a location id than an asset id, because the id will survive the asset. If a pole is replace at the same location, the new pole will get the same assetid. We know that this is not ideal from the point of view of asset management, but we will address this with an asset management system link to the GIS. Regarding your blog: Aqui se hable español. Lo leere con detenimiento, sole le di una hojeada.&lt;/LI&gt;&lt;LI&gt;I'm incrementing the distance, because we want to keep the id length to 6 characters. I was using the postfix as a print to console alternative. If Arcade had a development environment with step-by-step debugging and variables inspection, it would be easier to debug. I thinking something like what MS Office has for VBA.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Regards. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 19:55:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209835#M178</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2020-05-29T19:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209836#M179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To help with debugging, use pop ups in ArcGIS Pro.  That profile supports a lot of the same functions as attribute rules.  This can help track down coding issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 20:03:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209836#M179</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2020-05-29T20:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209837#M180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good to know. Thanks for the suggestion. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 22:36:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209837#M180</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2020-05-29T22:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209838#M181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not switch to generating it from ObjectID&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 15:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209838#M181</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2020-06-17T15:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209839#M182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the benefit of doing what you propose?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 16:43:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209839#M182</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2020-06-17T16:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209840#M183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would eliminated the need for this question.&amp;nbsp; ObjectID will be unique for any new feature created in the feature class&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 16:53:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209840#M183</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2020-06-17T16:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209841#M184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Objectid is only unique to that database.&amp;nbsp; If you use any type of disconnected capabilities, your objectid's are not maintained and will be different between databases.&amp;nbsp; I would not use ObjectID as a unique ID.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 17:11:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209841#M184</guid>
      <dc:creator>JohnAlsup</dc:creator>
      <dc:date>2020-06-17T17:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check for Duplicate AssetID Values with Arcade</title>
      <link>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209842#M185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You put the object id into a text field. I was under the assumption you were creating AssetID which is where you would put the objectID.&amp;nbsp; Then add something to distinguish that it belongs to that Feature Class.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And possibly format the number so it is&amp;nbsp; X number of characters long.&amp;nbsp;&lt;/P&gt;&lt;P&gt;example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New handhole.&amp;nbsp; ObjectID 4824&amp;nbsp; formatted to HH004824&amp;nbsp; &amp;nbsp; You would not use the objectID as the unique identifier for that Handhold because as you said when it goes to a different system the objectID's are new, but the unique AssetID would go where ever.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using objectID as the BASE of the AssetID would prevent you from creating duplicate AssetID's automatically.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 17:20:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/electric-questions/check-for-duplicate-assetid-values-with-arcade/m-p/209842#M185</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2020-06-17T17:20:31Z</dc:date>
    </item>
  </channel>
</rss>

