<?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: Attribute Rule for Sequential Numbers by Feature ID in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1420707#M83004</link>
    <description>&lt;P&gt;Rhett,&lt;/P&gt;&lt;P&gt;That pretty much did the trick - thank you!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did make a couple adjustments (lines 20,21 and 27). Added&amp;nbsp; IsEmpty to assign a value of 1 if NULL, and converted newID value to integer to match my field type. Oh, and changed "TITLE_NAME" to "TILE_NAME."&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intpoly = FeatureSetByName($datastore, "Section")  // load polygon dataset
var pointvals = FeatureSetByName($datastore,"Dedication",['ID'],false)  // load point dataset

var polyname = ''
var polyvals = ''

for( var f in intpoly){    // loop through polys and see which one intersects
   if(Intersects($feature, f)){
       var polyname = f.TILE_NAME}  // set polyname variable to the TILE_NAME of intersecting polygon
}
if (!IsEmpty(polyname)){
    var polyvals = Filter(pointvals, `TILE_NAME = '${polyname}'`) // If not empty, filter points by intersecting poly name
}
var numarray = []
for (var n in polyvals){
    Push(numarray, n.ID)  // push all ID for points with TILE_NAME matching they polygon name
}

var newID = Max(numarray)+1 // get the max ID number and add 1 to it
if (IsEmpty(newID)){
    newID = 1  // makes newID 1 if value is NULL
}
return {    // return a dictionary that updates TILE_NAME and ID in the points layer.
        "result": {
            "attributes": {
                //"TILE_NAME": polyname,
                "ID": Floor(newID, 0) // change to number with zero decimal places
            },
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 20:44:46 GMT</pubDate>
    <dc:creator>JwHayes</dc:creator>
    <dc:date>2024-05-08T20:44:46Z</dc:date>
    <item>
      <title>Attribute Rule for Sequential Numbers by Feature ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418823#M82744</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have 2/3 of the code someplete. The middle portion has stumped me. I have an immediate insert rule that inserts the section tile name when a new point feature is created.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var getSec = FeatureSetByName($datastore, "Section", ["TILE_NAME"])
var getSecInt = Intersects(getSec, $feature)
var sec = First(getSecInt)

if (sec == null) return {"errorMessage": "Section Not Found"}

return sec.TILE_NAME&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tha last part checks for null values and inserts the next sequential value.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// get the latest feature with a ID
var last_feature = First(OrderBy(Filter($featureset, "ID IS NOT NULL"), "OBJECTID DESC"))
// get the last CW_ID and add 1
var seq = IIf(last_feature == null, 0, last_feature.ID) + 1

return Number(seq)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works well for numbering all the features but what I need is sequential numbering by tile name. In the example below I'd like all the number on the left to be 4, 5, 6 and the numbers on the be 1 and 2. Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JwHayes_0-1714753959465.png" style="width: 774px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103029iF19EED6BAE71C767/image-dimensions/774x365?v=v2" width="774" height="365" role="button" title="JwHayes_0-1714753959465.png" alt="JwHayes_0-1714753959465.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, 03 May 2024 16:34:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418823#M82744</guid>
      <dc:creator>JwHayes</dc:creator>
      <dc:date>2024-05-03T16:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule for Sequential Numbers by Feature ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418894#M82754</link>
      <description>&lt;P&gt;Not sure I understand the question, but You might look at &lt;A href="https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-sequential-number-in-a-text-field/m-p/1364622/highlight/true#M76776" target="_self"&gt;this post t&lt;/A&gt;o see how I have dealt with similar need.&lt;/P&gt;&lt;P&gt;This shows one way to increment sequential numbers with a text component.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 18:44:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418894#M82754</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2024-05-03T18:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule for Sequential Numbers by Feature ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418907#M82756</link>
      <description>&lt;P&gt;Rhett,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply. Let's see if I can give you a better explanation.&lt;/P&gt;&lt;P&gt;Let's say I have two polygone (A,B) and a point feature class (Dedications). The Dedications feature class has two fields. "TILE_NAME" and "ID."&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add 3 dedication points to polygon A. When I add the first point the rule will append 'A' from the polygon to the the Dedications "TILE_NAME" Field and create a sequential number, in this case "1" to the the ID field. When I add points two and three "A" is applied to both points "TILE_NAME" fields, but the next sequential numbers are "2" and "3."&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to add a point to B. B is appended to "TILE_NAME" but "1" is created for the "ID" field. Then if I create another point in polygon A, the next ID would be "4."&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 19:09:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418907#M82756</guid>
      <dc:creator>JwHayes</dc:creator>
      <dc:date>2024-05-03T19:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule for Sequential Numbers by Feature ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418954#M82766</link>
      <description>&lt;P&gt;Quick modification to accomplish that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intpoly = FeatureSetByName($datastore, "Polygons_1")            // load polygon dataset
var pointvals = FeatureSetByName($datastore,"Dedications",['ID'],false)  // load point dataset

var polyname = ''
var polyvals = ''

for( var f in intpoly){                                             // loop through polys and see which one intersects
   if(Intersects($feature, f)){
       var polyname = f.TITLE_NAME}                                 // set polyname variable to the TITLE_NAME of intersecting polygon
}
if (!IsEmpty(polyname)){
    var polyvals = Filter(pointvals, `TITLE_NAME = '${polyname}'`)       // If not empty, filter points by intersecting poly name
}
var numarray = []
for (var n in polyvals){
    Push(numarray, n.ID)                              // push all ID for points with TITLE_NAME matching they polygon name
}
var newID = Max(numarray)+1                           // get the max ID number and add 1 to it
return {                                              // return a dictionary that updates TITLE_NAME and ID in the points layer.
        "result": {
            "attributes": {
                "TITLE_NAME": polyname,
                "ID": newID
            },
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, since this gets the values from the ID field from the Dedications point layer by polygon, you will need to have at least one point with the polygon name and an ID &amp;gt;= 0.&amp;nbsp; Otherwise, if you click on 'PolyA', and there is no entry for PolyA in the point file yet, the array of ID's will be empty, so it can't increment it by 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suspect you could also do some error checking here where it appends the TITLE_NAME and if the newID is null, set it to 1, but I normally don't have that many polygons, so I just create one point in each with TITLE_NAME for each polygon, and ID of 0.&amp;nbsp;&amp;nbsp; These 'dummy' points don't really need to fall within the polygons.&amp;nbsp; I normally make them off the side of my map area, and can be deleted once there are ID's for each TITLE_NAME.&amp;nbsp; (Also, no error checking here.&amp;nbsp; This assumes that each point added intersects ONLY 1 polygon (no overlapping polygons)&lt;/P&gt;&lt;P&gt;Hope this makes sense and gets you going in the right direction.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 22:01:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1418954#M82766</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2024-05-03T22:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule for Sequential Numbers by Feature ID</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1420707#M83004</link>
      <description>&lt;P&gt;Rhett,&lt;/P&gt;&lt;P&gt;That pretty much did the trick - thank you!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did make a couple adjustments (lines 20,21 and 27). Added&amp;nbsp; IsEmpty to assign a value of 1 if NULL, and converted newID value to integer to match my field type. Oh, and changed "TITLE_NAME" to "TILE_NAME."&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intpoly = FeatureSetByName($datastore, "Section")  // load polygon dataset
var pointvals = FeatureSetByName($datastore,"Dedication",['ID'],false)  // load point dataset

var polyname = ''
var polyvals = ''

for( var f in intpoly){    // loop through polys and see which one intersects
   if(Intersects($feature, f)){
       var polyname = f.TILE_NAME}  // set polyname variable to the TILE_NAME of intersecting polygon
}
if (!IsEmpty(polyname)){
    var polyvals = Filter(pointvals, `TILE_NAME = '${polyname}'`) // If not empty, filter points by intersecting poly name
}
var numarray = []
for (var n in polyvals){
    Push(numarray, n.ID)  // push all ID for points with TILE_NAME matching they polygon name
}

var newID = Max(numarray)+1 // get the max ID number and add 1 to it
if (IsEmpty(newID)){
    newID = 1  // makes newID 1 if value is NULL
}
return {    // return a dictionary that updates TILE_NAME and ID in the points layer.
        "result": {
            "attributes": {
                //"TILE_NAME": polyname,
                "ID": Floor(newID, 0) // change to number with zero decimal places
            },
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 20:44:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-for-sequential-numbers-by-feature/m-p/1420707#M83004</guid>
      <dc:creator>JwHayes</dc:creator>
      <dc:date>2024-05-08T20:44:46Z</dc:date>
    </item>
  </channel>
</rss>

