<?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: Finding the max of a field and adding 1 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142202#M11050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe !Version! in field calculator would represent each entry, calculating the max of that would only return itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by "&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;that if the field is 0, it will find the max for the field and add 1 to it. &lt;/SPAN&gt;" i'm assuming you mean:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;that if an entry in the field is 0, it will find the max for the field and add 1 to it. ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;find the max for the field first then run the calculate field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Mar 2020 18:04:59 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-03-31T18:04:59Z</dc:date>
    <item>
      <title>Finding the max of a field and adding 1</title>
      <link>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142201#M11049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to write an expression to use in model builder that if the field is 0, it will find the max for the field and add 1 to it. What I have so far is "(max([!Version!])+1) if !Version! ==0 else !Version!". The version field has integers from 0 to 5 right now. The dataset gets appended to periodically and we want to update the version to be the next number. Ideally, we would want the expression to find the max and add 1 to it but only add that value to rows with a Version value of 0 or null.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Find the max for the Version field&lt;/P&gt;&lt;P&gt;2. Calculate only features with the version values 0 (or prefereably null) with the max value +1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A select by attributes could be used to only calc the rows we want but then it will only get the max of what is selected and not the whole dataset. I tried to use the Calculate Value tool in modelbuilder to just get the max value but it wasn't working correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 17:49:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142201#M11049</guid>
      <dc:creator>Tim-Woodfield</dc:creator>
      <dc:date>2020-03-31T17:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the max of a field and adding 1</title>
      <link>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142202#M11050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe !Version! in field calculator would represent each entry, calculating the max of that would only return itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by "&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;that if the field is 0, it will find the max for the field and add 1 to it. &lt;/SPAN&gt;" i'm assuming you mean:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;that if an entry in the field is 0, it will find the max for the field and add 1 to it. ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;find the max for the field first then run the calculate field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:04:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142202#M11050</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-03-31T18:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the max of a field and adding 1</title>
      <link>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142203#M11051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't realize that it would only grab the max of each entry and not the whole field. My workaround was to bring in the summary statistics tool then feed that table into the Get Value tool to find the max value. I used the output of the Get Value as an inline variable to use in the field calculator. Seems to be working as intended now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 20:10:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/finding-the-max-of-a-field-and-adding-1/m-p/142203#M11051</guid>
      <dc:creator>Tim-Woodfield</dc:creator>
      <dc:date>2020-03-31T20:10:45Z</dc:date>
    </item>
  </channel>
</rss>

