<?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 Just got this working in python in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/just-got-this-working-in-python/m-p/762132#M24824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For any one who uses for loops to batch run tools in python, I just got this monster working this morning. Though I would share.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#the list holding the field data is formated like so:
#[fieldname, targetlayer, jointable, expression, fieldmap],
#the greater list is broken to a new line at the comma at the end of each list inside it
fieldList=[
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['backup_table.Co_FLU', r"C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp", r'C:\GIS Projects\CRW\TrakIt_Source_RS.gdb\Input_Data\flu', '[parce_test_spatial_join.FLU_CODE]', "A1RENUM 'A1RENUM' true true false 15 Text 0 0 ,First,#,C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp,A1RENUM,-1,-1;RE_LABEL 'RE_LABEL' true true false 15 Text 0 0 ,First,#,C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp,RE_LABEL,-1,-1;FLU_CODE 'FLU_CODE' true true false 15 Text 0 0 ,First,#,C:\\GIS Projects\\CRW\\TrakIt_Source_RS.gdb\\Input_Data\\flu,FLU_CODE,-1,-1"],
&amp;nbsp;&amp;nbsp;&amp;nbsp; [30 more lists go here but were cut for space reasons],
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]
def dataLoad(field, targetlayer, jointable, expression, fieldmap):
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.spatialjoin_analysis(targetlayer, jointable, r"C:\GIS Projects\CRW\parce_test_spatial_join.shp", "JOIN_ONE_TO_ONE", "KEEP_ALL", fieldmap,"INTERSECTS","0 Unknown","#")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.addjoin_management('parce_test', "A1RENUM", r"C:\GIS Projects\CRW\parce_test_spatial_join.shp", "A1RENUM", "KEEP_ALL")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.calculatefield_management('parce_test', field, expression, "VB", "#")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.removejoin_management("parce_test","parce_test_spatial_join")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.delete_management(r"C:\GIS Projects\CRW\parce_test_spatial_join.shp")
 
for parameter in fieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataLoad(parameter[0], parameter[1], parameter[2], parameter[3], parameter[4])
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Aug 2010 16:19:39 GMT</pubDate>
    <dc:creator>ChrisMathers</dc:creator>
    <dc:date>2010-08-19T16:19:39Z</dc:date>
    <item>
      <title>Just got this working in python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/just-got-this-working-in-python/m-p/762132#M24824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For any one who uses for loops to batch run tools in python, I just got this monster working this morning. Though I would share.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#the list holding the field data is formated like so:
#[fieldname, targetlayer, jointable, expression, fieldmap],
#the greater list is broken to a new line at the comma at the end of each list inside it
fieldList=[
&amp;nbsp;&amp;nbsp;&amp;nbsp; ['backup_table.Co_FLU', r"C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp", r'C:\GIS Projects\CRW\TrakIt_Source_RS.gdb\Input_Data\flu', '[parce_test_spatial_join.FLU_CODE]', "A1RENUM 'A1RENUM' true true false 15 Text 0 0 ,First,#,C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp,A1RENUM,-1,-1;RE_LABEL 'RE_LABEL' true true false 15 Text 0 0 ,First,#,C:\GIS Projects\CRW\parce_test_FeatureToPoint.shp,RE_LABEL,-1,-1;FLU_CODE 'FLU_CODE' true true false 15 Text 0 0 ,First,#,C:\\GIS Projects\\CRW\\TrakIt_Source_RS.gdb\\Input_Data\\flu,FLU_CODE,-1,-1"],
&amp;nbsp;&amp;nbsp;&amp;nbsp; [30 more lists go here but were cut for space reasons],
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]
def dataLoad(field, targetlayer, jointable, expression, fieldmap):
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.spatialjoin_analysis(targetlayer, jointable, r"C:\GIS Projects\CRW\parce_test_spatial_join.shp", "JOIN_ONE_TO_ONE", "KEEP_ALL", fieldmap,"INTERSECTS","0 Unknown","#")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.addjoin_management('parce_test', "A1RENUM", r"C:\GIS Projects\CRW\parce_test_spatial_join.shp", "A1RENUM", "KEEP_ALL")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.calculatefield_management('parce_test', field, expression, "VB", "#")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.removejoin_management("parce_test","parce_test_spatial_join")
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.delete_management(r"C:\GIS Projects\CRW\parce_test_spatial_join.shp")
 
for parameter in fieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataLoad(parameter[0], parameter[1], parameter[2], parameter[3], parameter[4])
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 16:19:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/just-got-this-working-in-python/m-p/762132#M24824</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2010-08-19T16:19:39Z</dc:date>
    </item>
  </channel>
</rss>

