<?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: Extract field values and use as parameter in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539504#M42172</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just did something similar but used a search cursor. I iterated through every row of a single field, then used that to build a definition query with the layer object. Sounds like a cursor might work for you...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 May 2011 01:50:57 GMT</pubDate>
    <dc:creator>ChrisBoyce</dc:creator>
    <dc:date>2011-05-20T01:50:57Z</dc:date>
    <item>
      <title>Extract field values and use as parameter</title>
      <link>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539503#M42171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using v10 and am I am wanting to extract a field value from a shapefile and use that value as a new parameter in my Python script.&amp;nbsp; However, there doesn't seem to be an easy way to do this.&amp;nbsp; There is a ModelBuilder Only tool named Get Field Value, but it can't be used in Python.&amp;nbsp; You can throw the tool into ModelBuilder, export it to a Python script, and try and use the code, but the following line of code did not work as there was an error opening the toolbox:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox("Model Functions")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm basically converting my shapefile to a table view, trying to run Get Field Value, and using that value as a parameter.&amp;nbsp; Any suggestions are greatly appreciated!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;KG&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 21:02:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539503#M42171</guid>
      <dc:creator>KyleGallagher</dc:creator>
      <dc:date>2011-05-19T21:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field values and use as parameter</title>
      <link>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539504#M42172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just did something similar but used a search cursor. I iterated through every row of a single field, then used that to build a definition query with the layer object. Sounds like a cursor might work for you...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2011 01:50:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539504#M42172</guid>
      <dc:creator>ChrisBoyce</dc:creator>
      <dc:date>2011-05-20T01:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field values and use as parameter</title>
      <link>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539505#M42173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I just did something similar but used a search cursor. I iterated through every row of a single field, then used that to build a definition query with the layer object. Sounds like a cursor might work for you...&lt;BR /&gt;&lt;BR /&gt;Chris.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you supply the search cursor code that worked for you?&amp;nbsp; I've seen it Arc 9 but I know it's a little different now with arcpy in Arc 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2011 02:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539505#M42173</guid>
      <dc:creator>KyleGallagher</dc:creator>
      <dc:date>2011-05-20T02:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field values and use as parameter</title>
      <link>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539506#M42174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is some cursor code and a way to get the value of a field&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(pathAndNameOfShapefile)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueOfField = row.getValue(fieldName) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #do something here with value

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del rows #delete cursor object variable
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row #delete row object variable
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;NOTE: pathAndNameOfShapefile and fieldName are set up as string variables if you use the actual path and name put quotes around it - the same goes for field name&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should also check out UpdateCursor and InsertCursor &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000001q000000.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000001q000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Specifying a query to get a specific set of rows &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Specifying_a_query_in_Python/002z0000001r000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Specifying_a_query_in_Python/002z0000001r000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Row methods &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v000000nv000000.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v000000nv000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:23:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-field-values-and-use-as-parameter/m-p/539506#M42174</guid>
      <dc:creator>TerrySilveus</dc:creator>
      <dc:date>2021-12-11T23:23:57Z</dc:date>
    </item>
  </channel>
</rss>

