<?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 Table value as auto increment pStart? in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/table-value-as-auto-increment-pstart/m-p/879893#M2813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do I use a value from a query table to be my starting value(pStart) in the auto increment code below:&lt;/P&gt;&lt;PRE class="" style="color: #595959; background-color: whitesmoke; font-weight: 300; font-size: 15.9375px; margin-bottom: 1.55rem;"&gt;rec=0&amp;nbsp; def autoIncrement():&amp;nbsp;&amp;nbsp; global rec&amp;nbsp;&amp;nbsp; pStart =&lt;SPAN style="color: #339966; font-size: 30px;"&gt; &lt;STRONG&gt;1 &lt;/STRONG&gt; &lt;/SPAN&gt; pInterval = 1&amp;nbsp;&amp;nbsp; if (rec == 0):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rec = pStart&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rec += pInterval&amp;nbsp;&amp;nbsp;&amp;nbsp; return rec&lt;/PRE&gt;&lt;P&gt;We are gathering statistics from a table using the max function, we need that max value to be the starting point for our auto increment. &amp;nbsp;How do we use that value as the pStart?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Aug 2016 13:43:06 GMT</pubDate>
    <dc:creator>JennethRoberts</dc:creator>
    <dc:date>2016-08-23T13:43:06Z</dc:date>
    <item>
      <title>Table value as auto increment pStart?</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/table-value-as-auto-increment-pstart/m-p/879893#M2813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do I use a value from a query table to be my starting value(pStart) in the auto increment code below:&lt;/P&gt;&lt;PRE class="" style="color: #595959; background-color: whitesmoke; font-weight: 300; font-size: 15.9375px; margin-bottom: 1.55rem;"&gt;rec=0&amp;nbsp; def autoIncrement():&amp;nbsp;&amp;nbsp; global rec&amp;nbsp;&amp;nbsp; pStart =&lt;SPAN style="color: #339966; font-size: 30px;"&gt; &lt;STRONG&gt;1 &lt;/STRONG&gt; &lt;/SPAN&gt; pInterval = 1&amp;nbsp;&amp;nbsp; if (rec == 0):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rec = pStart&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rec += pInterval&amp;nbsp;&amp;nbsp;&amp;nbsp; return rec&lt;/PRE&gt;&lt;P&gt;We are gathering statistics from a table using the max function, we need that max value to be the starting point for our auto increment. &amp;nbsp;How do we use that value as the pStart?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2016 13:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/table-value-as-auto-increment-pstart/m-p/879893#M2813</guid>
      <dc:creator>JennethRoberts</dc:creator>
      <dc:date>2016-08-23T13:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Table value as auto increment pStart?</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/table-value-as-auto-increment-pstart/m-p/879894#M2814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jenneth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this will be possible with ModelBuilder.&amp;nbsp; The Summary Stats tool creates a table output.&amp;nbsp; You will have to iterate the table to extract the value to a variable that you can pass to the CalculateField function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can export your ModelBuilder to Python by going to Model &amp;gt; Export &amp;gt; To Python Script.&amp;nbsp; Next, use a SearchCursor to iterate the output table from the Summary Stats tool.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;summaryStatsTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"MAX_VALUE_FIELD"&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;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maxValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then pass the maxValue variable to the CalculateField function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 11:05:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/table-value-as-auto-increment-pstart/m-p/879894#M2814</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-12T11:05:31Z</dc:date>
    </item>
  </channel>
</rss>

