<?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 clip script wich loops throught attributes of clipping layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318488#M24742</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attribute field must be a string defined field and it's all right&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jul 2016 09:58:11 GMT</pubDate>
    <dc:creator>JohannesBierer</dc:creator>
    <dc:date>2016-07-21T09:58:11Z</dc:date>
    <item>
      <title>Problem with clip script wich loops throught attributes of clipping layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318486#M24740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Error message in script which worked correctly days before? Any ideas why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line 16, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quercy = field + "=" + "'" + Loop1 + "'"&lt;/P&gt;&lt;P&gt;TypeError: cannot concatenate 'str' and 'int' objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
input = arcpy.GetParameterAsText(0)
clipfeature = arcpy.GetParameterAsText(1)
output = arcpy.GetParameterAsText(2)
clipfeature_Layer = "clipfeature_Layer"
arcpy.env.workspace = output
arcpy.env.overwriteOutput = True
field = "BFN_NR"
inputSp = input.split(";")
arcpy.MakeFeatureLayer_management(clipfeature, clipfeature_Layer, "", "", "")
cursor = arcpy.SearchCursor(clipfeature)
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(row.getValue(field))
&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop1 = row.getValue(field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; quercy = field + "=" + "'" + Loop1 + "'"

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management (clipfeature_Layer, "NEW_SELECTION", quercy)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Sel_shape = "Sel_" + Loop1 + ".shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(clipfeature_Layer, Sel_shape)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in inputSp:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_analysis(i, Sel_shape, "Clip_" + row.getValue(field) + "_" + i) &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:08:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318486#M24740</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2021-12-11T15:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with clip script wich loops throught attributes of clipping layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318487#M24741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;quercy = field + &lt;/SPAN&gt;&lt;SPAN class="string" style="color: blue; background-color: #f6f6f6; font-size: 9pt !important; font-family: Consolas, 'Courier New', Courier, mono, serif !important;"&gt;"="&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6; font-size: 9pt !important; font-family: Consolas, 'Courier New', Courier, mono, serif !important;"&gt; + &lt;/SPAN&gt;&lt;SPAN class="string" style="color: blue; background-color: #f6f6f6; font-size: 9pt !important; font-family: Consolas, 'Courier New', Courier, mono, serif !important;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN class="comment" style="color: #008200; background-color: #f6f6f6; font-size: 9pt !important; font-family: Consolas, 'Courier New', Courier, mono, serif !important;"&gt;"'" + str(Loop1) + "'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;just to ensure you have string values in case Loop1 returns a number&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 07:58:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318487#M24741</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-21T07:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with clip script wich loops throught attributes of clipping layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318488#M24742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attribute field must be a string defined field and it's all right&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 09:58:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318488#M24742</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2016-07-21T09:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with clip script wich loops throught attributes of clipping layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318489#M24743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doen't work with integer or number fields, obviously&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 09:58:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318489#M24743</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2016-07-21T09:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with clip script wich loops throught attributes of clipping layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318490#M24744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you could also try formatting it like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Loop1 = "somestring"
field = "BFN_NR"
quercy = ("{0} = '{1}'".format(field, Loop1))
print(quercy)
# returns...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BFN_NR = 'somestring'&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that's how I usually do it anyway (and surprised Dan didn't mention that &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-clip-script-wich-loops-throught/m-p/318490#M24744</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-11T15:08:25Z</dc:date>
    </item>
  </channel>
</rss>

