<?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: Sequentially numbering but only for certain rows in an attribute table in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176060#M55391</link>
    <description>&lt;P&gt;Did you try the assignment&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Number =&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;SequentialNumber(!Headstone!)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;?&amp;nbsp;— Andy&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2022 19:08:33 GMT</pubDate>
    <dc:creator>AndyAnderson</dc:creator>
    <dc:date>2022-05-20T19:08:33Z</dc:date>
    <item>
      <title>Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176055#M55390</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I want to sequentially number only particular features (headstones) in a table with location data for different types of stones, and I'm having trouble figuring out how to code this in Python.&lt;/P&gt;&lt;P&gt;I keep getting errors when I use SequentialNumber() and try to call the headstone field in the code block. Typing !Headstone! instead gives a syntax error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (519).png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41853iE41737252A34C598/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (519).png" alt="Screenshot (519).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Basically, I want to be able to number (and later label) only the headstones. Their order in the table is important too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Is there a better way to do this? Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 18:56:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176055#M55390</guid>
      <dc:creator>AlexZacher</dc:creator>
      <dc:date>2022-05-20T18:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176060#M55391</link>
      <description>&lt;P&gt;Did you try the assignment&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Number =&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;SequentialNumber(!Headstone!)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;?&amp;nbsp;— Andy&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 19:08:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176060#M55391</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-05-20T19:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176070#M55393</link>
      <description>&lt;P&gt;Hi Andy,&lt;/P&gt;&lt;P&gt;Thanks for your response! I have tried that. I get a different error with that method, stating:&lt;/P&gt;&lt;PRE&gt;ERROR 000539:&lt;SPAN class=""&gt; Traceback (most recent call last):
  File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;
TypeError: SequentialNumber() takes 0 positional arguments but 1 was given&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Failed to execute (CalculateField).&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 19:18:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176070#M55393</guid>
      <dc:creator>AlexZacher</dc:creator>
      <dc:date>2022-05-20T19:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176078#M55394</link>
      <description>&lt;P&gt;And was the function still written as in the picture above?&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;def SequentialNumber(Headstone)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This variable &lt;FONT face="courier new,courier"&gt;Headstone&lt;/FONT&gt;&amp;nbsp;is different than the variable &amp;nbsp;&lt;FONT face="courier new,courier"&gt;!Headstone!&lt;/FONT&gt;&amp;nbsp;used to call the function.&lt;/P&gt;&lt;P&gt;— Andy&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 19:36:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176078#M55394</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-05-20T19:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176082#M55395</link>
      <description>&lt;P&gt;I see! It was not when I got that error.&lt;/P&gt;&lt;P&gt;With the changes you suggested, the calculation seems to work, however, it is only applied to the first row of the table -- see the highlighted cell below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (523).png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41862i97BB894B9821FB60/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (523).png" alt="Screenshot (523).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did initially try to sort the values in the Headstone field by descending order, thinking that I might sequentially number the rows &lt;EM&gt;after&lt;/EM&gt; sorting them, then ask ArcGIS to stop labeling after a certain value. But the sorting method I tried seemed temporary, and I had some issues with field calculations getting stuck in the first row after that.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 19:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176082#M55395</guid>
      <dc:creator>AlexZacher</dc:creator>
      <dc:date>2022-05-20T19:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176085#M55396</link>
      <description>&lt;P&gt;The calculation is only applied to the first row because you have it selected. Click the deselect button at the top and try again. (This is a “feature” though one that I often forget to avoid!)&lt;/P&gt;&lt;P&gt;— Andy&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 19:45:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176085#M55396</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-05-20T19:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176094#M55398</link>
      <description>&lt;P&gt;Thank you! Wow, that had really been bothering me because I couldn't figure out what "fixed" the first row calculations earlier.&lt;/P&gt;&lt;P&gt;That is one problem solved, however, now it seems that the "return rec" line at the end of the code block causes the values in the new field to reset to zero after encountering a cell that is not a headstone (value = 0)... or something like that.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (524).png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41865iFBB1D542937C8CE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (524).png" alt="Screenshot (524).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is this a situation where learning how to program a loop might help?&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 20:00:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176094#M55398</guid>
      <dc:creator>AlexZacher</dc:creator>
      <dc:date>2022-05-20T20:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176103#M55399</link>
      <description>&lt;P&gt;You know what. That actually ended up being the solution to my problem!&lt;/P&gt;&lt;P&gt;I turned off all layers except the headstones, selected all of them, then ran the calculation from above. It only numbered the selected features sequentially.&lt;/P&gt;&lt;P&gt;Thank you so much for your help in this matter!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 20:16:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176103#M55399</guid>
      <dc:creator>AlexZacher</dc:creator>
      <dc:date>2022-05-20T20:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176115#M55402</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;rec = Headstone * (rec + pInterval)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the "Headstone" value = 0 (not a headstone), then "rec" becomes zero as you multiplied it by zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    if (rec == 0):
        rec = pStart&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, the next row, since it now see's "rec=0" will reset to pStart.&amp;nbsp; That is why it is "resetting" when not a headstone.&lt;/P&gt;&lt;P&gt;You can simply put a definition query on the layer where Headstone = 1.&lt;/P&gt;&lt;P&gt;then just use the &lt;SPAN&gt;SequentialNumber() as is and it will only calculate the sequential numbers for the Headstones (rows included in the definition query).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RhettZufelt_0-1653078681301.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41868i188B97BF0A13B4D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RhettZufelt_0-1653078681301.png" alt="RhettZufelt_0-1653078681301.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 20:38:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176115#M55402</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2022-05-20T20:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176122#M55406</link>
      <description>&lt;P&gt;Thanks! That's what I ended up doing. I'm accepting this post as the solution because it most thoroughly explains how to make this method work.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 20:54:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176122#M55406</guid>
      <dc:creator>AlexZacher</dc:creator>
      <dc:date>2022-05-20T20:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sequentially numbering but only for certain rows in an attribute table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176138#M55411</link>
      <description>&lt;P&gt;Re «"return rec" line at the end of the code block causes the values in the new field to reset to zero after encountering a cell that is not a headstone (value = 0)... or something like that.»&lt;/P&gt;&lt;P&gt;It’s not the statement&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;return rec&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;that’s resetting &lt;FONT face="courier new,courier"&gt;rec&lt;/FONT&gt;, it’s the statement&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;rec = Headstone * (rec + pinterval)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;that’s doing it. You’re resetting rec to zero whenever Headstone is zero. So just use this statement:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;rec += pinterval&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;but also add this statement as the first line in the function:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if Headstone == 0: return 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;— Andy&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 21:36:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/sequentially-numbering-but-only-for-certain-rows/m-p/1176138#M55411</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-05-20T21:36:16Z</dc:date>
    </item>
  </channel>
</rss>

