<?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: Select Maximum Value - Model Builder in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685670#M22745</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi there, &lt;BR /&gt;&lt;BR /&gt;I am new to model builder and am stuck on what is a seemingly simple task..&lt;BR /&gt;&lt;BR /&gt;I'd like the model to select the feature with the maximum value so that I can export and use it as my starting point for least cost path iterations. &lt;BR /&gt;&lt;BR /&gt;In my case, I just need the feature with the highest numerical value for Near_Dist to be selected. &lt;BR /&gt;&lt;BR /&gt;I have looked into the sort tool&amp;nbsp; (sort by descending then select first row), using code blocks and search cursors for calculate field or the select tool,&amp;nbsp; building expressions in select by attributes using somethine like: "Near_Dist=(SELECT MAX(Near_Dist) FROM TableName)"&lt;BR /&gt;&lt;BR /&gt;But I have been unsuccessful so I am resorting to this forum.&amp;nbsp; Please let me know if you have encountered this before / have any ideas on what I could do. &lt;BR /&gt;&lt;BR /&gt;Thanks so much in advance!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use Summary and create an output table with the Max value, Join it to the original feature class/table (create a layer or tableview first), and select where OBJECTID of the join table is not Null using Select By Attribute, then remove the Join.&amp;nbsp; This is the way I always do Statistical selections, although usually I am doing it using a group field unique value as the join field rather than the summary output itself as the join field.&amp;nbsp; And even more frequently I am doing this technique to use the join to transfer a statistical output back to the original table using the Field Calculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the join fails (because joins on double values is not always reliable and in which case you should not use =, but instead use &amp;gt;= to deal with imprecision) you could at least read the value in the output to a variable and then do a simple SQL expression directly on the original feature class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Near_Dist &amp;gt;= %value% - .0000001&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 May 2013 21:21:22 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2013-05-27T21:21:22Z</dc:date>
    <item>
      <title>Select Maximum Value - Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685669#M22744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new to model builder and am stuck on what is a seemingly simple task..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd like the model to select the feature with the maximum value so that I can export and use it as my starting point for least cost path iterations. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my case, I just need the feature with the highest numerical value for Near_Dist to be selected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have looked into the sort tool&amp;nbsp; (sort by descending then select first row), using code blocks and search cursors for calculate field or the select tool,&amp;nbsp; building expressions in select by attributes using somethine like: "Near_Dist=(SELECT MAX(Near_Dist) FROM TableName)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I have been unsuccessful so I am resorting to this forum.&amp;nbsp; Please let me know if you have encountered this before / have any ideas on what I could do. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 May 2013 19:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685669#M22744</guid>
      <dc:creator>ShinoRah</dc:creator>
      <dc:date>2013-05-27T19:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select Maximum Value - Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685670#M22745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi there, &lt;BR /&gt;&lt;BR /&gt;I am new to model builder and am stuck on what is a seemingly simple task..&lt;BR /&gt;&lt;BR /&gt;I'd like the model to select the feature with the maximum value so that I can export and use it as my starting point for least cost path iterations. &lt;BR /&gt;&lt;BR /&gt;In my case, I just need the feature with the highest numerical value for Near_Dist to be selected. &lt;BR /&gt;&lt;BR /&gt;I have looked into the sort tool&amp;nbsp; (sort by descending then select first row), using code blocks and search cursors for calculate field or the select tool,&amp;nbsp; building expressions in select by attributes using somethine like: "Near_Dist=(SELECT MAX(Near_Dist) FROM TableName)"&lt;BR /&gt;&lt;BR /&gt;But I have been unsuccessful so I am resorting to this forum.&amp;nbsp; Please let me know if you have encountered this before / have any ideas on what I could do. &lt;BR /&gt;&lt;BR /&gt;Thanks so much in advance!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use Summary and create an output table with the Max value, Join it to the original feature class/table (create a layer or tableview first), and select where OBJECTID of the join table is not Null using Select By Attribute, then remove the Join.&amp;nbsp; This is the way I always do Statistical selections, although usually I am doing it using a group field unique value as the join field rather than the summary output itself as the join field.&amp;nbsp; And even more frequently I am doing this technique to use the join to transfer a statistical output back to the original table using the Field Calculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the join fails (because joins on double values is not always reliable and in which case you should not use =, but instead use &amp;gt;= to deal with imprecision) you could at least read the value in the output to a variable and then do a simple SQL expression directly on the original feature class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Near_Dist &amp;gt;= %value% - .0000001&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 May 2013 21:21:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685670#M22745</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-05-27T21:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Maximum Value - Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685671#M22746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much for those ideas. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used inline variables once before and then was when I was doing an iterator tutorial. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure how I would read the value in the output to a variable.&amp;nbsp; I re-labelled the output of summary stats to %Value% &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then did a select by attributes with your SQL expression [Near_Dist &amp;gt;= %Value% - .0000001] but I got invalid SQL errors.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a step I am missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 13:36:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685671#M22746</guid>
      <dc:creator>ShinoRah</dc:creator>
      <dc:date>2013-05-28T13:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Maximum Value - Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685672#M22747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks so much for those ideas. &lt;BR /&gt;&lt;BR /&gt;I've used inline variables once before and then was when I was doing an iterator tutorial. &lt;BR /&gt;&lt;BR /&gt;I'm not sure how I would read the value in the output to a variable.&amp;nbsp; I re-labelled the output of summary stats to %Value% &lt;BR /&gt;&lt;BR /&gt;and then did a select by attributes with your SQL expression [Near_Dist &amp;gt;= %Value% - .0000001] but I got invalid SQL errors.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Is there a step I am missing?&lt;BR /&gt;&lt;BR /&gt;Thanks again!!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The variable cannot use the direct output of the summary, which is a table, not a numeric value.&amp;nbsp; You can use a Feature Selection Iterator on the Summary output which would output a variable named %value% automatically and then the expression should work without the brackets.&amp;nbsp; Make the Select by Attribute operation have the Iterator output as a precondition.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A python cursor could also read the record of the Summary output as an alternative if this was a python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you try doing a join of the summary output to the original table and using the ObjectID syntax?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 13:48:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685672#M22747</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-05-28T13:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select Maximum Value - Model Builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685673#M22748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I ended up using 'iterate row selection' on the summary stats output and using your SQL in the select by attributes expression. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It worked and you are awesome. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 15:02:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-maximum-value-model-builder/m-p/685673#M22748</guid>
      <dc:creator>ShinoRah</dc:creator>
      <dc:date>2013-05-28T15:02:12Z</dc:date>
    </item>
  </channel>
</rss>

