<?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: Problem with select analysis + copy rows in loop in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345154#M27092</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also a good point, Blake. Perhaps the ultimate solution is to post the "correct" answer as an edit at the bottom of your original question, mark as correct the person who gave the closest answer, and give a helpful to everyone who contributed. Poor Kon! He will feel like he can't do anything right!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2015 22:56:40 GMT</pubDate>
    <dc:creator>SepheFox</dc:creator>
    <dc:date>2015-04-07T22:56:40Z</dc:date>
    <item>
      <title>Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345124#M27062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i am trying to implement various combinations of tools trying to export some rows&amp;nbsp; from a pnt shapefile based on a query (or&lt;STRONG&gt; while&lt;/STRONG&gt; or&lt;STRONG&gt; for loop&lt;/STRONG&gt;).I have a column (Condition) with values TRUE and FALSE and i want to export every row for the statement,&amp;nbsp; &lt;STRONG&gt;Condition = "TRUE"&lt;/STRONG&gt;. However i &lt;STRONG&gt;only want those rows&lt;/STRONG&gt; who respond to TRUE and if a FALSE follows i don't want to export nothing else, although after FALSE maybe there are more TRUE.&lt;/P&gt;&lt;P&gt;an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;FID&amp;nbsp; Condition&amp;nbsp;&amp;nbsp;&amp;nbsp; H&amp;nbsp;&amp;nbsp;&amp;nbsp; Wo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FID&amp;nbsp; Condition&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; H&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wo&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 54&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;SPAN style="text-decoration: underline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 54&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 54&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I want only &lt;STRONG&gt;these&lt;/STRONG&gt; values&amp;nbsp; ---&amp;gt;&amp;nbsp;&amp;nbsp; 2&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE &lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; with the rest of the fields&amp;nbsp;&amp;nbsp;&amp;nbsp; 54&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;&lt;EM&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FALSE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp; 25 &lt;/EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 98&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="font-size: 8pt; font-family: 'times new roman', times;"&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/SPAN&gt;&lt;/H5&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are the samples of code i tried, to export the rows based my statement :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;fc = "c:/Task/data/In.shp"&lt;/P&gt;&lt;P&gt;outworkspace = "c:/Task/data/In.shp"&lt;/P&gt;&lt;P&gt;fields = ["FID", "Condition", "H", "Wo"]&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(fc, fields) as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while [row] = 'TRUE':&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRows_management("In", "c:/Task/data/Out.shp")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also with select analysis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;env.workspace = "c:/Task/data/In.shp"&lt;/P&gt;&lt;P&gt;fc = "c:/Task/data/In.shp"&lt;/P&gt;&lt;P&gt;fields = ["FID", "Condition", "H", "Wo"]&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(fc, fields) as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while [row] = 'TRUE':&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Select_analysis("In", "Out_s", '[Condition] = "TRUE"'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for some reason i always get an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 14:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345124#M27062</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T14:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345125#M27063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you do the process manually once, then copy and modify the python code snippet from the Results Window (under Customize menu).&amp;nbsp; I have documented several examples of using this approach to develop scripts that employ Arctoolbox tools.&amp;nbsp; Also, I am not sure which field you are querying nor what you are updating given you are using an update cursor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:00:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345125#M27063</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-04-03T15:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345126#M27064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a lot of little things wrong with your code. Before I try creating new code, I have a question. It looks like you have a second condition you are using to filter your table, could you please describe that? Right now I see the only thing you check is that the Condition field is equal to "TRUE". What criteria did you use to eliminate FID 4 and 5?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:21:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345126#M27064</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-04-03T15:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345127#M27065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want the procedure to stop when it finds a FALSE statement but i don't know how to write it, this is the criteria for the elimination of all values after the first false. I just want to do a check with while (while Condition = True) and copy only them until TRUE become FALSE. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345127#M27065</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T15:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345128#M27066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's not reliable because you cannot guarantee the order in which the rows are returned. Could you describe in more detail why you only want to copy rows until it finds a FALSE?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:32:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345128#M27066</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-04-03T15:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345129#M27067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example on how you can do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\temp\python\test.gdb"

point = "Point"

list = []

with arcpy.da.SearchCursor(point, ["OID@", "Condition"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == 'True':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif row[1] == 'False':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(x)

del cursor

#convert list to string
list = str(list).strip('[]')

#create a feature layer of only features within list
arcpy.MakeFeatureLayer_management(point, "pointLyr", "OBJECTID in (" + list + ")")

#create feature class from feature layer
arcpy.CopyFeatures_management("pointLyr", "pointSelection")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:15:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345129#M27067</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T16:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345130#M27068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I am not trying to update anything I am using update cursor trying to iterate from row to row. I cannot think another way. In Python I know how to do it but the combinations with ArcPy cause me a big headache. Can you paste a link to your approach examples?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:39:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345130#M27068</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T15:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345131#M27069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == 'True':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; elif row[1] == 'False':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(x)&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Wouldn't that only get the last row that is TRUE? &lt;SPAN style="font-family: 'courier new', courier;"&gt;x&lt;/SPAN&gt; gets replaced each time it's true and only gets appended to &lt;SPAN style="font-family: 'courier new', courier;"&gt;list&lt;/SPAN&gt; when it finds a FALSE. Seems like you'd have to do something like&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == 'True':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp; elif row[1] == 'False':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345131#M27069</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T16:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345132#M27070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These are distances betweens points along a route. When i have a false statement that means that i must stop there and copy all the records until that point. That is why i want all the records until the first FALSE Statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:48:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345132#M27070</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T15:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345133#M27071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jake thanks for your response but i tested it with the correction of Mr. Blake T and i got an "ERROR 000230: Failed selecting with OBJECTID in () Failed to execute (MakeFeatureLayer).&amp;nbsp; "&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345133#M27071</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T16:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345134#M27072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I misunderstood&amp;nbsp; your initial question.&amp;nbsp; I thought you only wanted the first True condition before the False condition.&amp;nbsp; If you want all True conditions, Blake's update should work.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like the code is failing when you are trying to create the Feature Layer.&amp;nbsp; Can you &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;post&lt;/A&gt; the code you tried?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:11:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345134#M27072</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-04-03T16:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345135#M27073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;right away:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy &lt;/P&gt;&lt;P&gt;... from arcpy import env &lt;/P&gt;&lt;P&gt;... env.overwriteOutput = 1 &lt;/P&gt;&lt;P&gt;... env.workspace = "c:\Task\Data\In.mxd" &lt;/P&gt;&lt;P&gt;... point = "route" &lt;/P&gt;&lt;P&gt;... list = [] &lt;/P&gt;&lt;P&gt;... with arcpy.da.SearchCursor(point, ["OID@", "Condition"]) as cursor:&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == 'True':&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(row[0])&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif row[1] == 'False':&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;...&amp;nbsp; &lt;/P&gt;&lt;P&gt;... del cursor &lt;/P&gt;&lt;P&gt;...&amp;nbsp; &lt;/P&gt;&lt;P&gt;... #convert list to string &lt;/P&gt;&lt;P&gt;... list = str(list).strip('[]') &lt;/P&gt;&lt;P&gt;...&amp;nbsp; &lt;/P&gt;&lt;P&gt;... #create a feature layer of only features within list &lt;/P&gt;&lt;P&gt;... arcpy.MakeFeatureLayer_management(point, "pointLyr", "OBJECTID in (" + list + ")") &lt;/P&gt;&lt;P&gt;...&amp;nbsp; &lt;/P&gt;&lt;P&gt;... #create feature class from feature layer &lt;/P&gt;&lt;P&gt;... arcpy.CopyFeatures_management("pointLyr", "pointSelection") &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345135#M27073</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T16:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345136#M27074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your workspace has to be a geodatabase, not an MXD. Also, the point variable is the name your input feature class (not a the layer name from an MXD).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;EDIT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You may also need to change the strings in the if statement from "True" to "TRUE" and "False" to "FALSE" so it matches your data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:36:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345136#M27074</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-04-03T16:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345137#M27075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you working with a route &lt;STRONG&gt;Event Layer&lt;/STRONG&gt;?&amp;nbsp; The event layer most likely does not have a field called OBJECTID.&amp;nbsp; Open the attribute table and see what this field may be.&amp;nbsp; For example, it may be FID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have this field, update the arcpy.MakeFeatureLayer_management command.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14280791384178568 jive_text_macro" data-renderedposition="113_8_912_16" jivemacro_uid="_14280791384178568"&gt;&lt;P&gt;arcpy.MakeFeatureLayer_management(point, "pointLyr", "FID in (" + list + ")")&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:39:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345137#M27075</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-04-03T16:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345138#M27076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jake no i don't have an Event Layer. i just have a shapefile with many pnts and fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345138#M27076</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-03T16:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345139#M27077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The same will apply to a shapefile.&amp;nbsp; The shapefile will not have a field called OBJECTID.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345139#M27077</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-04-03T16:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345140#M27078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, you will need to update the last line to write the output to a shapefile or geodatabase.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14280800647502368 jive_macro_code jive_text_macro" data-renderedposition="50_8_912_16" jivemacro_uid="_14280800647502368"&gt;&lt;P&gt;arcpy.CopyFeatures_management("pointLyr", r"C:\temp\pointSelection.shp")&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:54:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345140#M27078</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-04-03T16:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345141#M27079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jade thanks a lot for your reply, but when i test it i get back an 00230 error: ERROR 000230: Failed selecting with FID in () Failed to execute (MakeFeatureLayer).&amp;nbsp; &lt;/P&gt;&lt;H1&gt;000230 : Failed selecting with &amp;lt;value&amp;gt;.&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 19:08:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345141#M27079</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-04T19:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345142#M27080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you check the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00vp00000005000230"&gt;help file on that error message&lt;/A&gt;?&amp;nbsp; In short, it means that the query doesn't work.&amp;nbsp; Did you try it manually?&amp;nbsp; Did you verify that it worked? Did you read the help topic on&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s50000002t000000"&gt; about building an SQL expression&lt;/A&gt;?&amp;nbsp; When you can perform the tasks manually, documenting what you did and what worked, you will have the workings of a script.&amp;nbsp; I will emphasize that using the Results window (see the Customize menu) and using tools from ArcToolbox is the fastest way of building a script that works from start to finish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 19:18:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345142#M27080</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-04-04T19:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select analysis + copy rows in loop</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345143#M27081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mr Patterson i read it, and i saw the query again. I guess something is going wrong &lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;with &lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; text-decoration: underline;"&gt;FID in ("&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000; text-decoration: underline;"&gt; + list + &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; text-decoration: underline;"&gt;")" &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;but i have nerer use an expression like this to correct it. In my mind for my task was only select analysis in a while loop, this is a different approach and propably the correct but something is wrong in the code. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;Manually i did it with my code and it worked, but the problem i have here is that i cannot do it for an example like this I shew you in my example, where TRUE and FALSE statements are mixed.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;You mentioned that with results window again, i always see what the results window appear and here isn't not showing something different than the error in Python window. It just says :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;Invalid SQL statement was used&amp;nbsp; and&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;Failed to execute (Make Feature Layer)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 20:09:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-select-analysis-copy-rows-in-loop/m-p/345143#M27081</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2015-04-04T20:09:30Z</dc:date>
    </item>
  </channel>
</rss>

