<?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 Automatic numbering of object in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300300#M52904</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;is it possible to create a rule using Arcade that assigns an individual number starting from 1 to an object?&lt;/P&gt;&lt;P&gt;When placing an object, it should receive the number 1. When placing a second object, the second object should receive the number 2. And so on...&lt;/P&gt;&lt;P&gt;Now, if I have 10 objects numbered from 1 to 10, and let's say I delete object number 5, all the objects following 5 should be renumbered from 6 to 9.&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 17:03:48 GMT</pubDate>
    <dc:creator>MaikHeinze</dc:creator>
    <dc:date>2023-06-16T17:03:48Z</dc:date>
    <item>
      <title>Automatic numbering of object</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300300#M52904</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;is it possible to create a rule using Arcade that assigns an individual number starting from 1 to an object?&lt;/P&gt;&lt;P&gt;When placing an object, it should receive the number 1. When placing a second object, the second object should receive the number 2. And so on...&lt;/P&gt;&lt;P&gt;Now, if I have 10 objects numbered from 1 to 10, and let's say I delete object number 5, all the objects following 5 should be renumbered from 6 to 9.&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 17:03:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300300#M52904</guid>
      <dc:creator>MaikHeinze</dc:creator>
      <dc:date>2023-06-16T17:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic numbering of object</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300509#M52906</link>
      <description>&lt;P&gt;It might be possible but I think it could be horribly inefficient.&amp;nbsp; Imagine you've got 10,000 records and you delete record number 5, since attribute rules are executed against one record at a time you'd need to wait for 9,995 updates to take place.&lt;/P&gt;&lt;P&gt;What do you need a sequence like this for?&amp;nbsp; Assuming you aren't working with versioned data, you could derive it from the Object ID at the time it's required.&amp;nbsp; If you are working with versioned data, you could use editor tracking and the create date to perform this type of operation at the time it's required.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 19:59:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300509#M52906</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2023-06-17T19:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic numbering of object</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300541#M52910</link>
      <description>&lt;P&gt;I am working with a predefined range of numbers that need to be assigned to cabinets. The maximum number of assigned numbers will never exceed 20. This should still be within the limits, right?&lt;/P&gt;&lt;P&gt;Is it possible to create a rule for this in Arcade? And how would it look like?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jun 2023 09:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300541#M52910</guid>
      <dc:creator>MaikHeinze</dc:creator>
      <dc:date>2023-06-18T09:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic numbering of object</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300551#M52911</link>
      <description>&lt;P&gt;I think it would be reasonable with a maximum 20 records.&amp;nbsp; I don't write these types of Arcade statements very often so I'd defer to others (I did put a rough idea below however), but are you working in an Enterprise environment with versioning?&amp;nbsp; If so I don't think it would be possible without the risk of ID collisions upon reconciliation.&lt;/P&gt;&lt;P&gt;If you aren't working with versioning, I think something like these two rules would work:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Rule one, on create:&lt;UL&gt;&lt;LI&gt;Query the feature set and find the maximum existing ID&lt;/LI&gt;&lt;LI&gt;Set the new record's ID to the maximum plus one&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Rule two, on delete:&lt;UL&gt;&lt;LI&gt;On the delete operation, get the deleted feature's ID&lt;/LI&gt;&lt;LI&gt;Get a feature set with all features that have a higher ID than that number&lt;/LI&gt;&lt;LI&gt;Decrement each ID by one, updating each feature&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Alternatively, as part of your editing workflow, create a simple Python script (maybe deployed as a GP tool) that reads the features in an update cursor, ordering by OID or creation date, and sets the IDs in a sequence.&amp;nbsp; You could also do this with the Field Calculator and the "Code Block" parameter.&amp;nbsp; Again, if versioning is involved, it gets more complicated (but still possible this way).&lt;/P&gt;&lt;P&gt;Also, just to be 100% sure, what is your data source?&amp;nbsp; A File GDB?&amp;nbsp; Or - since this question is under the ArcGIS Online community - are you using an ArcGIS Online hosted feature layer?&amp;nbsp; If it's an AGOL feature layer I'm fairly certain they don't support attribute rules yet.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jun 2023 11:56:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300551#M52911</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2023-06-18T11:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic numbering of object</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300852#M52925</link>
      <description>&lt;P&gt;Take a look at this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/field-calculate-sequential-numbers-starting-with/m-p/310695" target="_blank"&gt;https://community.esri.com/t5/python-questions/field-calculate-sequential-numbers-starting-with/m-p/310695&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 21:05:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/automatic-numbering-of-object/m-p/1300852#M52925</guid>
      <dc:creator>DavidForbuss1</dc:creator>
      <dc:date>2023-06-19T21:05:25Z</dc:date>
    </item>
  </channel>
</rss>

